Redirect 404s to www.meepleprofessionals.com (#7) #20
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 url-shortener | |
on: | |
push: | |
branches: | |
- main | |
env: | |
region: us-east-1 | |
bucket: meeple.pro | |
lambda_function_name: url_shortener | |
jobs: | |
build-lambda: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Build and package | |
shell: bash | |
run: | | |
cd lambda | |
yarn | |
yarn package | |
- uses: actions/upload-artifact@v3 | |
with: | |
name: lambda-artifact | |
path: lambda/dist/lambda.zip | |
build-infra: | |
needs: | |
- build-lambda | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: actions/download-artifact@v3 | |
with: | |
name: lambda-artifact | |
- uses: marocchino/tool-versions-action@v1 | |
id: tool-versions | |
# Warning: The `set-output` command is deprecated and will be | |
# disabled soon. Please upgrade to using Environment Files. | |
# For more information see: | |
# https://github.blog/changelog/2022-10-11-github-actions-deprecating-save-state-and-set-output-commands/ | |
- name: Setup Terragrunt | |
uses: autero1/[email protected] | |
with: | |
terragrunt_version: ${{ steps.tool-versions.outputs.terragrunt }} | |
- name: Terragrunt Apply | |
run: | | |
cd terraform | |
terragrunt init --terragrunt-non-interactive --terragrunt-config prod-terragrunt.hcl | |
terragrunt apply -auto-approve --terragrunt-config prod-terragrunt.hcl | |
env: | |
AWS_ACCESS_KEY_ID: ${{ secrets.aws_access_key_id }} | |
AWS_SECRET_ACCESS_KEY: ${{ secrets.aws_secret_access_key }} | |
AWS_DEFAULT_REGION: ${{ env.region }} | |
upload-webpage-update-lambda: | |
needs: | |
- build-infra | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: actions/download-artifact@v3 | |
with: | |
name: lambda-artifact | |
- name: S3 Endpoint Upload | |
run: | | |
aws lambda update-function-code \ | |
--function-name ${{ env.lambda_function_name }} \ | |
--zip-file fileb://lambda.zip | |
shell: bash | |
env: | |
AWS_ACCESS_KEY_ID: ${{ secrets.aws_access_key_id }} | |
AWS_SECRET_ACCESS_KEY: ${{ secrets.aws_secret_access_key }} | |
AWS_DEFAULT_REGION: ${{ env.region }} |