Skip to content

Merge remote-tracking branch 'origin/staging' into develop #67

Merge remote-tracking branch 'origin/staging' into develop

Merge remote-tracking branch 'origin/staging' into develop #67

Workflow file for this run

---
name: Deploy Sanitas
on: # yamllint disable-line rule:truthy
push:
branches:
- staging
workflow_dispatch:
permissions:
contents: read
pages: write
id-token: write
jobs:
backend-deploy:
environment:
name: build
name: Backend Deployment
runs-on: ubuntu-latest
outputs:
backend_url: ${{ steps.get_url_step.outputs.url }}
secure_url: ${{ steps.get_secure_url.outputs.url }}
cognito_user_pool_id: ${{ steps.get_pool_id.outputs.id }}
cognito_pool_client_id: ${{ steps.get_client_id.outputs.id }}
defaults:
run:
shell: nix develop .#cicdBackend --command bash {0}
working-directory: sanitas_backend
steps:
- uses: actions/checkout@v4
with:
ref: staging
- uses: DeterminateSystems/nix-installer-action@main
- name: Configure AWS Credentials Action for GitHub Actions
uses: aws-actions/[email protected]
with:
audience: sts.amazonaws.com
aws-region: us-east-2
role-to-assume: ${{ secrets.BACKEND_DEPLOY_AWS_ROLE }}
- name: Building Backend
run: sam build --use-container
- name: Deploying Backend
# yamllint disable rule:line-length
run: sam deploy --no-confirm-changeset --no-fail-on-empty-changeset
--parameter-overrides PostgresURL=${{ secrets.DB_URL }}
- name: Saving Backend URL
id: get_url_step
run: echo url=$(sam list stack-outputs --stack-name sanitas-backend
--output json | jq .[1].OutputValue | sed -e 's/^\"//' -e
's/\/\"$//') >> $GITHUB_OUTPUT
- name: Saving Secured Backend URL
id: get_secure_url
run: echo url=$(sam list stack-outputs --stack-name sanitas-backend
--output json | jq .[0].OutputValue | sed -e 's/^\"//' -e
's/\/\"$//') >> $GITHUB_OUTPUT
- name: Saving Cognito Pool ID
id: get_pool_id
run: echo id=$(sam list resources --stack-name sanitas-backend
--output json | jq '.[] | select(.LogicalResourceId == "CognitoUserPool")
| .PhysicalResourceId' | sed -e 's/^\"//' -e 's/\"$//') >>
$GITHUB_OUTPUT
- name: Saving Cognito Client ID
id: get_client_id
run: echo id=$(sam list resources --stack-name sanitas-backend
--output json | jq '.[] | select(.LogicalResourceId == "CognitoUserPoolClient")
| .PhysicalResourceId' | sed -e 's/^\"//' -e 's/\"$//') >>
$GITHUB_OUTPUT
# yamllint enable rule:line-length
frontend-deploy:
name: Frontend Deployment
needs: backend-deploy
environment:
name: build
url: ${{ steps.deployment.outputs.page_url }}
runs-on: ubuntu-latest
defaults:
run:
shell: nix develop .#cicdFrontend --command bash {0}
working-directory: sanitas_frontend
steps:
- uses: actions/checkout@v4
with:
ref: staging
- uses: DeterminateSystems/nix-installer-action@main
- uses: actions/configure-pages@v4
- name: Building frontend
# yamllint disable rule:line-length
run: yarn && BACKEND_URL=${{ needs.backend-deploy.outputs.backend_url
}} COGNITO_POOL_ID=${{ needs.backend-deploy.outputs.cognito_user_pool_id
}} COGNITO_CLIENT_ID=${{ needs.backend-deploy.outputs.cognito_pool_client_id
}} PROTECTED_URL=${{ needs.backend-deploy.outputs.secure_url
}} yarn build --base=/Sanitas/
# yamllint enable rule:line-length
- name: Uploading to Github pages
uses: actions/upload-pages-artifact@v3
with:
path: ./sanitas_frontend/dist
- uses: actions/deploy-pages@v4
id: deployment