Release Please #291
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 Please | |
| on: | |
| workflow_run: | |
| workflows: ["Build and Push Docker Images"] | |
| types: | |
| - completed | |
| branches: | |
| - main | |
| workflow_dispatch: | |
| inputs: | |
| note: | |
| description: "Optional note for why this run was triggered manually." | |
| required: false | |
| type: string | |
| permissions: | |
| contents: write | |
| issues: write | |
| pull-requests: write | |
| jobs: | |
| release-please: | |
| runs-on: ubuntu-latest | |
| # Only run automatically if the image build workflow succeeded; manual runs skip this gate. | |
| if: github.event_name == 'workflow_dispatch' || github.event.workflow_run.conclusion == 'success' | |
| # Serialize release-please runs so concurrent Docker-build completions | |
| # don't race each other and hit "tag already_exists" errors. | |
| concurrency: | |
| group: release-please | |
| cancel-in-progress: false | |
| outputs: | |
| releases_created: ${{ steps.release.outputs.releases_created }} | |
| backend_release_created: ${{ steps.release.outputs['apps/backend--release_created'] }} | |
| backend_tag_name: ${{ steps.release.outputs['apps/backend--tag_name'] }} | |
| backend_version: ${{ steps.release.outputs['apps/backend--version'] }} | |
| backend_sha: ${{ steps.release.outputs['apps/backend--sha'] }} | |
| web_release_created: ${{ steps.release.outputs['apps/web--release_created'] }} | |
| web_tag_name: ${{ steps.release.outputs['apps/web--tag_name'] }} | |
| web_version: ${{ steps.release.outputs['apps/web--version'] }} | |
| web_sha: ${{ steps.release.outputs['apps/web--sha'] }} | |
| steps: | |
| - uses: googleapis/release-please-action@v5 | |
| id: release | |
| with: | |
| # PAT so release PRs trigger other workflows (auto-label, add-issues-and-prs-to-fs-project-board). | |
| # This PAT has the permissions outlined in https://github.com/googleapis/release-please-action?tab=readme-ov-file#workflow-permissions. | |
| # Using GITHUB_TOKEN suppresses follow-on workflow runs, which would mean release-please PRs wouldn't get properly labeled and added to the project board. | |
| token: ${{ secrets.FILOZZY_RELEASE_PLEASE_PAT }} | |
| config-file: release-please-config.json | |
| manifest-file: .release-please-manifest.json | |
| retag-backend: | |
| needs: release-please | |
| if: needs.release-please.outputs.backend_release_created == 'true' | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: read | |
| packages: write | |
| steps: | |
| - name: Login to GitHub Container Registry | |
| uses: docker/login-action@v4 | |
| with: | |
| registry: ghcr.io | |
| username: ${{ github.actor }} | |
| password: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Retag backend image | |
| run: | | |
| SOURCE_SHA="${{ needs.release-please.outputs.backend_sha }}" | |
| VERSION="${{ needs.release-please.outputs.backend_version }}" | |
| REPO="ghcr.io/filozone/dealbot-backend" | |
| echo "Retagging ${REPO}:sha-${SOURCE_SHA} → ${REPO}:v${VERSION}" | |
| # Use docker buildx imagetools to create a new tag pointing to the same image | |
| docker buildx imagetools create \ | |
| --tag "${REPO}:v${VERSION}" \ | |
| "${REPO}:sha-${SOURCE_SHA}" | |
| echo "✅ Backend released: v${VERSION}" | |
| retag-web: | |
| needs: release-please | |
| if: needs.release-please.outputs.web_release_created == 'true' | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: read | |
| packages: write | |
| steps: | |
| - name: Login to GitHub Container Registry | |
| uses: docker/login-action@v4 | |
| with: | |
| registry: ghcr.io | |
| username: ${{ github.actor }} | |
| password: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Retag web image | |
| run: | | |
| SOURCE_SHA="${{ needs.release-please.outputs.web_sha }}" | |
| VERSION="${{ needs.release-please.outputs.web_version }}" | |
| REPO="ghcr.io/filozone/dealbot-web" | |
| echo "Retagging ${REPO}:sha-${SOURCE_SHA} → ${REPO}:v${VERSION}" | |
| # Use docker buildx imagetools to create a new tag pointing to the same image | |
| docker buildx imagetools create \ | |
| --tag "${REPO}:v${VERSION}" \ | |
| "${REPO}:sha-${SOURCE_SHA}" | |
| echo "✅ Web released: v${VERSION}" |