add `Deploy serverless Lambda TypeScript API with function url using … #380
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: how.wtf CI | |
on: | |
push: | |
branches: | |
- main | |
jobs: | |
changes: | |
runs-on: ubuntu-latest | |
permissions: | |
pull-requests: read | |
outputs: | |
infrastructure: ${{ steps.changes.outputs.infrastructure }} | |
publication: ${{ steps.changes.outputs.publication }} | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
submodules: true | |
token: ${{ secrets.GH_TOKEN }} | |
- uses: dorny/paths-filter@v2 | |
id: changes | |
with: | |
filters: | | |
infrastructure: | |
- 'terraform/**' | |
publication: | |
- 'content/**' | |
- 'static/**' | |
- 'themes/**' | |
- 'config.yml' | |
infrastructure: | |
needs: changes | |
if: ${{ needs.changes.outputs.infrastructure == 'true' }} | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
submodules: true | |
token: ${{ secrets.GH_TOKEN }} | |
- uses: hashicorp/setup-terraform@v2 | |
with: | |
terraform_wrapper: false | |
- 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 | |
- uses: dorny/paths-filter@v2 | |
id: changes | |
with: | |
filters: | | |
global: | |
- 'terraform/env/global/**' | |
website: | |
- 'terraform/env/prod/**' | |
- name: Deploy global infrastructure | |
if: steps.changes.outputs.global == 'true' | |
run: ./bin/deploy.sh global | |
- name: Deploy website infrastructure | |
if: steps.changes.outputs.website == 'true' | |
run: ./bin/deploy.sh prod | |
publication: | |
needs: changes | |
if: ${{ needs.changes.outputs.publication == 'true' }} | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
submodules: true | |
token: ${{ secrets.GH_TOKEN }} | |
- 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 | |
- name: Build website files | |
run: ./bin/dh.sh -t "how.wtf" -b | |
- name: Publish website | |
run: ./bin/upload.sh -t "how.wtf" -b "how.wtf" |