Skip to content

Commit

Permalink
build: Add release please to the ci/cd for production deployment. (#1049
Browse files Browse the repository at this point in the history
)

#### Motivation

We don't need manual release after adding release please.

#### Modification

Move prod deploy steps to release please workflow

#### Checklist

_If not applicable, provide explanation of why._

- [ ] Tests updated
- [ ] Docs updated
- [ ] Issue linked in Title
  • Loading branch information
Wentao-Kuang authored Feb 27, 2025
1 parent 5bcbb02 commit ad60b97
Show file tree
Hide file tree
Showing 2 changed files with 46 additions and 30 deletions.
30 changes: 0 additions & 30 deletions .github/workflows/push.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,33 +8,3 @@ jobs:

steps:
- uses: linz/action-typescript@9bf69b0f313b3525d3ba3116f26b1aff7eb7a6c0 # v3.1.0

deploy-prod:
runs-on: ubuntu-latest
concurrency: deploy-prod-${{ github.ref }}
needs: [main]
if: github.ref == 'refs/heads/master' && github.repository == 'linz/lds-cache'

permissions:
id-token: write
contents: write

environment:
name: prod

steps:
- uses: linz/action-typescript@9bf69b0f313b3525d3ba3116f26b1aff7eb7a6c0 # v3.1.0

- name: (Prod) Configure AWS Credentials
uses: aws-actions/configure-aws-credentials@010d0da01d0b5a38af31e9c3470dbfdabdecca3a # v4
with:
aws-region: ap-southeast-2
mask-aws-account-id: true
role-to-assume: ${{ secrets.AWS_ROLE_ARN }}

- name: (Prod) Deploy
run: |
npx cdk deploy --require-approval never
env:
NODE_ENV: "production"
CACHE_BUCKET_NAME: "linz-lds-cache"
46 changes: 46 additions & 0 deletions .github/workflows/release-please.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
on:
push:
branches:
- master

name: release-please
jobs:
release-please:
runs-on: ubuntu-latest
outputs:
releases_created: ${{ steps.release.outputs.releases_created }}
steps:
- uses: google-github-actions/release-please-action@v3
id: release
with:
release-type: node
token: ${{ secrets.GITHUB_TOKEN }}

publish-release:
needs: release-please
runs-on: ubuntu-latest

permissions:
id-token: write
contents: write

environment:
name: prod

if: ${{ needs.release-please.outputs.releases_created }}
steps:
- uses: linz/action-typescript@9bf69b0f313b3525d3ba3116f26b1aff7eb7a6c0 # v3.1.0

- name: (Prod) Configure AWS Credentials
uses: aws-actions/configure-aws-credentials@010d0da01d0b5a38af31e9c3470dbfdabdecca3a # v4
with:
aws-region: ap-southeast-2
mask-aws-account-id: true
role-to-assume: ${{ secrets.AWS_ROLE_ARN }}

- name: (Prod) Deploy
run: |
npx cdk deploy --require-approval never
env:
NODE_ENV: 'production'
CACHE_BUCKET_NAME: 'linz-lds-cache'

0 comments on commit ad60b97

Please sign in to comment.