add lambda deployment #2
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 | |
on: | |
push: | |
branches: | |
- 'master' | |
permissions: | |
id-token: write | |
contents: read | |
jobs: | |
build: | |
name: Build | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v3 | |
- name: Setup python | |
uses: actions/setup-python@v4 | |
with: | |
python-version: '3.x' | |
- name: Build mkdocs | |
run: | | |
pip install mkdocs-material mkdocs-material-extensions | |
mkdocs -q build | |
- name: Configure AWS Credentials with OIDC | |
uses: aws-actions/configure-aws-credentials@v1 | |
with: | |
role-to-assume: arn:aws:iam::167422901596:role/gha_nocontent | |
aws-region: "eu-central-1" | |
- name: Upload docs | |
run: | | |
aws s3 sync --delete .docs/ s3://nocontent.xyz/ | |
- name: Invalidate Cloudfront | |
run: aws cloudfront create-invalidation --distribution-id "E1TX7G3VGQGAF4" --path "/*" | |
- name: Setup Go | |
uses: actions/setup-go@v4 | |
with: | |
go-version: '>=1.21' | |
- name: Build lambda function | |
run: go build | |
- name: Deploy new Lambda function | |
run: | | |
zip package.zip nocontent Inconsolata.ttf | |
aws lambda update-function-code --function-name placeholder-image --zip-file fileb://package.zip |