release-stable #2
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-stable | |
| on: | |
| workflow_dispatch: {} | |
| permissions: | |
| contents: read | |
| packages: write | |
| env: | |
| IMAGE_NAME: ghcr.io/perishcode/mini-packages-api | |
| jobs: | |
| publish-api: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v6.0.2 | |
| - uses: dtolnay/rust-toolchain@stable | |
| - uses: Swatinem/rust-cache@v2 | |
| with: | |
| workspaces: api -> target | |
| save-if: false | |
| - name: Test API | |
| working-directory: api | |
| run: cargo test --locked | |
| - name: Capture build timestamp | |
| id: build_meta | |
| run: echo "timestamp=$(date -u +%Y-%m-%dT%H:%M:%SZ)" >> "$GITHUB_OUTPUT" | |
| - uses: docker/setup-buildx-action@v4 | |
| - uses: docker/login-action@v4 | |
| with: | |
| registry: ghcr.io | |
| username: ${{ github.actor }} | |
| password: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Publish stable API image | |
| uses: docker/build-push-action@v7 | |
| with: | |
| context: ./api | |
| push: true | |
| build-args: | | |
| APP_BUILD_SHA=${{ github.sha }} | |
| APP_BUILD_TIMESTAMP=${{ steps.build_meta.outputs.timestamp }} | |
| cache-from: type=gha,scope=mini-packages-api | |
| cache-to: type=gha,mode=max,scope=mini-packages-api | |
| tags: | | |
| ${{ env.IMAGE_NAME }}:latest | |
| ${{ env.IMAGE_NAME }}:sha-${{ github.sha }} | |
| - name: Best-effort public visibility | |
| env: | |
| GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| run: gh api -X PATCH /user/packages/container/mini-packages-api/visibility -f visibility=public || true |