Deploy resources to AWS PROD/DEV by @devksingh4 #183
This file contains 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: Deploy Resources to AWS PROD/DEV | |
run-name: Deploy resources to AWS PROD/DEV by @${{ github.actor }} | |
on: | |
workflow_dispatch: | |
push: | |
branches: | |
- main | |
jobs: | |
deploy-aws-dev: | |
runs-on: ubuntu-latest | |
concurrency: | |
group: resume-book-aws-dev | |
cancel-in-progress: false | |
environment: "AWS DEV" | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: aws-actions/setup-sam@v2 | |
with: | |
use-installer: true | |
- uses: aws-actions/configure-aws-credentials@v2 | |
with: | |
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }} | |
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | |
aws-region: us-east-1 | |
- run: make deploy_dev | |
test-dev: | |
runs-on: ubuntu-latest | |
needs: | |
- deploy-aws-dev | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Set up Python 3.11 for testing | |
uses: actions/setup-python@v5 | |
with: | |
python-version: 3.11 | |
- name: Run live testing | |
run: make test_ci | |
deploy-aws-prod: | |
runs-on: ubuntu-latest | |
concurrency: | |
group: resume-book-aws-prod | |
cancel-in-progress: false | |
needs: | |
- test-dev | |
- deploy-aws-dev | |
environment: "AWS PROD" | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: aws-actions/setup-sam@v2 | |
with: | |
use-installer: true | |
- uses: aws-actions/configure-aws-credentials@v2 | |
with: | |
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }} | |
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | |
aws-region: us-east-1 | |
- run: make deploy_prod | |
deploy-cf-pages-prod: | |
runs-on: ubuntu-latest | |
needs: | |
- test-dev | |
permissions: | |
contents: read | |
deployments: write | |
name: Deploy to Cloudflare Pages Prod | |
environment: "Cloudflare Pages - Prod" | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Build | |
run: cd clientv2 && yarn && yarn run build | |
- name: Publish | |
uses: cloudflare/pages-action@v1 | |
with: | |
apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }} | |
accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }} | |
projectName: resume-book-prod | |
directory: clientv2/dist/ | |
gitHubToken: ${{ secrets.GITHUB_TOKEN }} | |
health-check-prod: | |
runs-on: ubuntu-latest | |
needs: | |
- deploy-aws-prod | |
- deploy-cf-pages-prod | |
steps: | |
- name: Call the API healthz endpoint | |
run: curl -f https://resume-api.acm.illinois.edu/api/v1/healthz | |
- name: Call the base UI endpoint | |
run: curl -f https://resumes.acm.illinois.edu |