Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
51 changes: 51 additions & 0 deletions .github/workflows/release-please.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@ permissions:
jobs:
release:
runs-on: ubuntu-latest
outputs:
release_created: ${{ steps.release.outputs.release_created }}
tag_name: ${{ steps.release.outputs.tag_name }}
steps:
- name: Generate GitHub App token
id: app-token
Expand All @@ -21,6 +24,7 @@ jobs:
private-key: ${{ secrets.SBP_RELEASE_PLEASE_APP_PRIVATE_KEY }}

- uses: googleapis/release-please-action@v5
id: release
with:
release-type: python
package-name: sbp-backend
Expand All @@ -39,3 +43,50 @@ jobs:
{"type":"chore","section":"Chores","hidden":true},
{"type":"test","section":"Tests","hidden":true}
]

# Publishes an immutable, version-tagged image for prod to promote, right at
# the point a release is actually cut (merging the release-please PR) — no
# extra manual step beyond what's already done, and no new IAM trust needed
# since this job still runs under the same push-to-staging OIDC identity as
# build-push-deploy.yml's staging job.
publish-release-image:
needs: release
if: needs.release.outputs.release_created == 'true'
runs-on: ubuntu-latest
permissions:
id-token: write
contents: read
env:
AWS_REGION: ap-southeast-2
AWS_ACCOUNT_ID: '456789093900'
ECR_REPOSITORY: sbp-backend
steps:
- name: Checkout release tag
uses: actions/checkout@v7
with:
ref: ${{ needs.release.outputs.tag_name }}

- uses: docker/setup-buildx-action@v4

- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v6
with:
role-to-assume: arn:aws:iam::${{ env.AWS_ACCOUNT_ID }}:role/sbp-backend-staging-github-actions-deploy-role
aws-region: ${{ env.AWS_REGION }}

- name: Log in to Amazon ECR
id: login-ecr
uses: aws-actions/amazon-ecr-login@v2

- name: Build & Push release image
uses: docker/build-push-action@v7
with:
context: .
file: ./Dockerfile
platforms: linux/amd64
push: true
tags: ${{ steps.login-ecr.outputs.registry }}/${{ env.ECR_REPOSITORY }}:${{ needs.release.outputs.tag_name }}
provenance: false
sbom: false
cache-from: type=gha
cache-to: type=gha,mode=max
Loading