@@ -3,8 +3,10 @@ name: Infrastructure Deployment
33# Controls when the action will run. Triggers the workflow on push or pull request
44# events but only for the main branch
55on :
6+ release :
7+ types : [released]
68 push :
7- branches : [main, dev ]
9+ branches : [main]
810 paths-ignore :
911 - " **/README.md"
1012 - " **/readme.md"
@@ -17,9 +19,9 @@ concurrency:
1719
1820# A workflow run is made up of one or more jobs that can run sequentially or in parallel
1921jobs :
20- # This workflow contains a single job called "build"
2122 build :
22- environment : ${{ github.ref == 'refs/heads/main' && 'Production' || 'Development' }}
23+ runs-on : ubuntu-20.04
24+ environment : ${{ github.event_name == 'release' && 'Production' || 'Development' }}
2325 env :
2426 MONGODB_PASSWORD : ${{ secrets.MONGODB_PASSWORD }}
2527 GOOGLE_API_KEY : ${{ secrets.GOOGLE_API_KEY }}
@@ -34,14 +36,20 @@ jobs:
3436 GIT_REPOSITORY_URL : https://github.com/neu-dsg/dailp-encoding
3537 OAUTH_TOKEN : ${{ secrets.OAUTH_TOKEN }}
3638 RUST_LOG : info
37- TF_STAGE : ${{ github.ref == 'refs/heads/main' && 'prod' || 'dev' }}
38- # The type of runner that the job will run on
39- runs-on : ubuntu-latest
39+ TF_STAGE : ${{ github.event_name == 'release' && 'prod' || 'dev' }}
4040
4141 # Steps represent a sequence of tasks that will be executed as part of the job
4242 steps :
4343 - name : Checkout code
4444 uses : actions/checkout@v2
45+ with :
46+ fetch-depth : 0
47+ - name : Push to release branch
48+ if : ${{ github.event_name == 'release' }}
49+ uses : ad-m/github-push-action@master
50+ with :
51+ branch : release
52+ force : true
4553 - name : Configure AWS credentials
4654 uses : aws-actions/configure-aws-credentials@v1
4755 with :
0 commit comments