Merge pull request #47 from mctofu/dependabot/go_modules/golang.org/x… #24
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: Go build and deploy | |
on: | |
push: | |
branches: [ main ] | |
jobs: | |
build: | |
name: Deploy | |
runs-on: ubuntu-latest | |
steps: | |
- name: Check out code into the Go module directory | |
uses: actions/checkout@v4 | |
- name: Set up Go 1.x | |
uses: actions/setup-go@v5 | |
with: | |
go-version-file: 'go.mod' | |
id: go | |
- name: Test | |
run: go test -cover ./... | |
- name: Build artifact | |
run: | | |
CGO_ENABLED=0 go build -v -tags lambda.norpc -o bootstrap github.com/mctofu/water-monitor/cmd/monitor | |
zip water-monitor.zip bootstrap | |
- name: Configure AWS credentials | |
uses: aws-actions/configure-aws-credentials@v4 | |
with: | |
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }} | |
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | |
aws-region: ${{ secrets.AWS_REGION }} | |
- name: Deploy | |
run: | | |
aws lambda update-function-code \ | |
--function-name ${{ secrets.FUNCTION_NAME }} \ | |
--zip-file fileb://water-monitor.zip > /dev/null |