Prepare v0.0.2 release #4
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Release | |
| on: | |
| push: | |
| tags: | |
| - 'v*.*.*' | |
| permissions: | |
| contents: write | |
| packages: write | |
| jobs: | |
| verify: | |
| name: Verify | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Set up Bun | |
| uses: oven-sh/setup-bun@v2 | |
| with: | |
| bun-version: 1.3.11 | |
| - name: Install dependencies | |
| run: bun install --frozen-lockfile | |
| - name: Build | |
| run: bun run build | |
| - name: Test | |
| run: bun test | |
| - name: Lint | |
| run: bun run lint | |
| image: | |
| name: Publish GHCR Image | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 30 | |
| needs: verify | |
| outputs: | |
| version: ${{ steps.version.outputs.version }} | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Resolve release version | |
| id: version | |
| shell: bash | |
| run: | | |
| VERSION="${GITHUB_REF_NAME#v}" | |
| echo "version=${VERSION}" >> "$GITHUB_OUTPUT" | |
| echo "created=$(date -u +%Y-%m-%dT%H:%M:%SZ)" >> "$GITHUB_OUTPUT" | |
| - name: Set up Docker Buildx | |
| uses: docker/setup-buildx-action@v3 | |
| - name: Login to GHCR | |
| uses: docker/login-action@v3 | |
| with: | |
| registry: ghcr.io | |
| username: ${{ github.actor }} | |
| password: ${{ github.token }} | |
| - name: Extract Docker metadata | |
| id: meta | |
| uses: docker/metadata-action@v5 | |
| with: | |
| images: ghcr.io/corebunch/instatic | |
| tags: | | |
| type=semver,pattern={{version}} | |
| type=semver,pattern={{major}}.{{minor}} | |
| type=raw,value=latest | |
| - name: Build and push image | |
| uses: docker/build-push-action@v6 | |
| with: | |
| context: . | |
| platforms: linux/amd64 | |
| push: true | |
| tags: ${{ steps.meta.outputs.tags }} | |
| labels: ${{ steps.meta.outputs.labels }} | |
| build-args: | | |
| INSTATIC_VERSION=${{ steps.version.outputs.version }} | |
| INSTATIC_REVISION=${{ github.sha }} | |
| INSTATIC_CREATED=${{ steps.version.outputs.created }} | |
| dockerhub: | |
| name: Mirror To Docker Hub | |
| runs-on: ubuntu-latest | |
| needs: image | |
| steps: | |
| - name: Resolve release version | |
| id: version | |
| shell: bash | |
| run: echo "version=${GITHUB_REF_NAME#v}" >> "$GITHUB_OUTPUT" | |
| - name: Check Docker Hub credentials | |
| id: credentials | |
| env: | |
| DOCKERHUB_USERNAME: ${{ secrets.DOCKERHUB_USERNAME }} | |
| DOCKERHUB_TOKEN: ${{ secrets.DOCKERHUB_TOKEN }} | |
| shell: bash | |
| run: | | |
| if [ -n "$DOCKERHUB_USERNAME" ] && [ -n "$DOCKERHUB_TOKEN" ]; then | |
| echo "enabled=true" >> "$GITHUB_OUTPUT" | |
| else | |
| echo "enabled=false" >> "$GITHUB_OUTPUT" | |
| fi | |
| - name: Set up Docker Buildx | |
| if: steps.credentials.outputs.enabled == 'true' | |
| uses: docker/setup-buildx-action@v3 | |
| - name: Login to GHCR | |
| if: steps.credentials.outputs.enabled == 'true' | |
| uses: docker/login-action@v3 | |
| with: | |
| registry: ghcr.io | |
| username: ${{ github.actor }} | |
| password: ${{ github.token }} | |
| - name: Login to Docker Hub | |
| if: steps.credentials.outputs.enabled == 'true' | |
| uses: docker/login-action@v3 | |
| with: | |
| username: ${{ secrets.DOCKERHUB_USERNAME }} | |
| password: ${{ secrets.DOCKERHUB_TOKEN }} | |
| - name: Mirror image | |
| if: steps.credentials.outputs.enabled == 'true' | |
| run: | | |
| docker buildx imagetools create \ | |
| --tag docker.io/corebunch/instatic:${{ steps.version.outputs.version }} \ | |
| --tag docker.io/corebunch/instatic:latest \ | |
| ghcr.io/corebunch/instatic:${{ steps.version.outputs.version }} | |
| - name: Report skipped mirror | |
| if: steps.credentials.outputs.enabled != 'true' | |
| run: echo "Docker Hub mirror skipped because DOCKERHUB_USERNAME or DOCKERHUB_TOKEN is not configured." | |
| bundle: | |
| name: Publish Release Bundle | |
| runs-on: ubuntu-latest | |
| needs: | |
| - verify | |
| - image | |
| - dockerhub | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Set up Bun | |
| uses: oven-sh/setup-bun@v2 | |
| with: | |
| bun-version: 1.3.11 | |
| - name: Install dependencies | |
| run: bun install --frozen-lockfile | |
| - name: Build release bundle | |
| run: bun run release:bundle -- "${{ needs.image.outputs.version }}" | |
| - name: Create release if missing | |
| env: | |
| GH_TOKEN: ${{ github.token }} | |
| shell: bash | |
| run: | | |
| if gh release view "$GITHUB_REF_NAME" >/dev/null 2>&1; then | |
| exit 0 | |
| fi | |
| gh release create "$GITHUB_REF_NAME" \ | |
| --title "Instatic ${{ needs.image.outputs.version }}" \ | |
| --generate-notes | |
| - name: Upload release bundle | |
| env: | |
| GH_TOKEN: ${{ github.token }} | |
| run: | | |
| gh release upload "$GITHUB_REF_NAME" \ | |
| ".tmp/release/instatic-${{ needs.image.outputs.version }}-release-bundle.tar.gz" \ | |
| --clobber |