Merge pull request #248 from gotoeveryone/dependabot/go_modules/githu… #530
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: Build | |
on: [push] | |
jobs: | |
code_check: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up Golang | |
uses: actions/setup-go@v5 | |
with: | |
go-version: "1.21" | |
cache-dependency-path: | | |
**/go.sum | |
- name: Execute code check | |
run: go vet ./... | |
test: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up Golang | |
uses: actions/setup-go@v5 | |
with: | |
go-version: "1.21" | |
cache-dependency-path: | | |
**/go.sum | |
- name: Execute test | |
run: go test ./... | |
deploy: | |
if: contains(github.ref, 'tags/v') | |
needs: | |
- code_check | |
- test | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up Golang | |
uses: actions/setup-go@v5 | |
with: | |
go-version: "1.21" | |
cache-dependency-path: | | |
**/go.sum | |
- name: Build | |
env: | |
GOOS: linux | |
GOARCH: amd64 | |
CGO_ENABLED: 0 | |
run: go build -tags lambda.norpc -o deploy/bootstrap ./src/main.go | |
- name: Generate config file | |
run: | | |
cat deploy/function.json.example | \ | |
jq -r ".Role=\"${{ secrets.IAM_ROLE_ARN }}\"" | \ | |
jq -r ".Environment.Variables.IDENTIFIER=\"${{ secrets.IDENTIFIER }}\"" | \ | |
jq -r ".Environment.Variables.GROUPING_NAME=\"${{ secrets.GROUPING_NAME }}\"" > deploy/function.json | |
- name: Configure AWS Credentials | |
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: ap-northeast-1 | |
- uses: fujiwara/lambroll@v1 | |
with: | |
version: v1.0.5 | |
- name: Deploy | |
working-directory: deploy | |
run: lambroll deploy | |
notify_slack: | |
if: ${{ always() && contains(github.ref, 'tags/v') }} | |
needs: | |
- deploy | |
runs-on: ubuntu-latest | |
steps: | |
- uses: technote-space/workflow-conclusion-action@v3 | |
- name: Notify to Slack | |
uses: 8398a7/action-slack@v3 | |
with: | |
status: ${{ env.WORKFLOW_CONCLUSION }} | |
author_name: GitHub Actions | |
fields: repo,message,author,ref | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
SLACK_WEBHOOK_URL: ${{ secrets.NOTIFY_SLACK_WEBHOOK_URL }} |