Skip to content

Commit cb502ca

Browse files
authored
Adjust and add new worflow to the new deployment way (#272)
1 parent 4078bbd commit cb502ca

File tree

2 files changed

+77
-1
lines changed

2 files changed

+77
-1
lines changed
Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
name: Manually trigger deploy to staging or production
2+
run-name: "Manually deploy ${{ github.ref_name }} triggered by ${{ github.actor }}; version: ${{ inputs.version }}"
3+
4+
on:
5+
workflow_dispatch:
6+
inputs:
7+
version:
8+
description: "Enter the version number"
9+
required: true
10+
default: "main"
11+
environment:
12+
required: false
13+
description: "Select the environment to deploy to"
14+
type: choice
15+
options:
16+
- staging
17+
# TODO: uncomment this when we want to deploy to production
18+
# - production
19+
default: staging
20+
21+
permissions:
22+
id-token: write
23+
contents: read
24+
25+
jobs:
26+
trigger-staging-deploy:
27+
runs-on: ubuntu-latest
28+
if: ${{ inputs.version != '' && inputs.environment == 'staging' }}
29+
environment: production-fidl
30+
steps:
31+
- name: Trigger staging deploy
32+
uses: neti-filplus-infra/filplus-deploy-action@main
33+
with:
34+
version: ${{ inputs.version }}
35+
environment: ${{ inputs.environment }}
36+
ecr-repository: filplus-backend
37+
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID_IMAGE_DEPLOYER }}
38+
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY_IMAGE_DEPLOYER }}
39+
aws-region: us-east-1
40+
41+
trigger-production-deploy:
42+
runs-on: ubuntu-latest
43+
if: ${{ github.ref_name == 'main' && inputs.version != '' && inputs.environment == 'production' }}
44+
environment: production-fidl
45+
steps:
46+
- name: Trigger production deploy
47+
uses: neti-filplus-infra/filplus-deploy-action@main
48+
with:
49+
version: ${{ inputs.version }}
50+
environment: ${{ inputs.environment }}
51+
ecr-repository: filplus-registry
52+
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID_IMAGE_DEPLOYER }}
53+
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY_IMAGE_DEPLOYER }}
54+
aws-region: us-east-1

.github/workflows/publish-new-build.yml

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,11 @@ on:
1313
description: "Enter the version number"
1414
required: true
1515
default: "latest"
16+
deploy-to-staging:
17+
description: "Deploy the new version on staging?"
18+
required: false
19+
type: boolean
20+
default: false
1621

1722
jobs:
1823
code-check:
@@ -80,9 +85,26 @@ jobs:
8085
uses: actions/checkout@v4
8186
with:
8287
ref: ${{ needs.bump-version.outputs.commit_sha }}
83-
8488
- name: Create and push tag
8589
run: |
8690
TAG_NAME="v${{ inputs.version }}"
8791
git tag $TAG_NAME
8892
git push origin $TAG_NAME
93+
94+
trigger-staging-deploy:
95+
runs-on: ubuntu-latest
96+
needs:
97+
- code-check
98+
- build-and-publish
99+
if: ${{ inputs.version != '' && inputs.deploy-to-staging == true }}
100+
environment: production-fidl
101+
steps:
102+
- name: Trigger staging deploy
103+
uses: neti-filplus-infra/filplus-deploy-action@main
104+
with:
105+
version: ${{ inputs.version }}
106+
environment: staging
107+
ecr-repository: filplus-backend
108+
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID_IMAGE_DEPLOYER }}
109+
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY_IMAGE_DEPLOYER }}
110+
aws-region: us-east-1

0 commit comments

Comments
 (0)