Merge pull request #30 from wilburx9/develop #19
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 the AWS Lambdas | |
on: | |
push: | |
branches: | |
- 'live' | |
paths: | |
- 'backend/**' | |
jobs: | |
deploy-backend: | |
runs-on: ubuntu-latest | |
permissions: | |
contents: read | |
id-token: write | |
steps: | |
- name: Checkout repo | |
uses: actions/checkout@v3 | |
- name: Setup Go | |
uses: actions/setup-go@v4 | |
with: | |
go-version: 1.20.x | |
- name: Build subscribe function | |
working-directory: backend | |
run: | | |
GOOS=linux GOARCH=amd64 CGO_ENABLED=0 go build subscribe.go | |
zip -j ./subscribe.zip ./subscribe | |
- name: Build broadcast function | |
working-directory: backend | |
run: | | |
GOOS=linux GOARCH=amd64 CGO_ENABLED=0 go build broadcast.go | |
zip -j ./broadcast.zip ./broadcast | |
- name: Configure AWS credentials | |
uses: aws-actions/configure-aws-credentials@v2 | |
with: | |
role-to-assume: ${{ secrets.AWS_ROLE }} | |
aws-region: ${{ secrets.AWS_REGION }} | |
- name: Deploy subscribe function | |
working-directory: backend | |
run: | | |
aws lambda update-function-code --function-name ${{ vars.LAMBDA_FUNCTION_SUBSCRIBE }} --zip-file fileb://./subscribe.zip | |
- name: Deploy broadcast function | |
working-directory: backend | |
run: | | |
aws lambda update-function-code --function-name ${{ vars.LAMBDA_FUNCTION_BROADCAST }} --zip-file fileb://./broadcast.zip | |