upgrade to go 1.24 #181
Workflow file for this run
This file contains hidden or 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: Test, Deploy, Publish | |
on: | |
push: | |
branches: [ '**' ] | |
tags: [ 'v*' ] | |
paths-ignore: | |
- 'terraform/**' | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.ref }} | |
cancel-in-progress: false | |
jobs: | |
tests: | |
name: Tests | |
runs-on: ubuntu-latest | |
env: | |
AWS_REGION: us-east-1 | |
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} | |
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Test | |
run: docker compose run app go test ./... | |
lint: | |
name: Lint and Vulnerability Scan | |
runs-on: ubuntu-latest | |
timeout-minutes: ${{ fromJSON(vars.DEFAULT_JOB_TIMEOUT_MINUTES) }} | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- uses: actions/setup-go@v5 | |
with: | |
go-version-file: 'go.mod' | |
check-latest: true | |
- name: golangci-lint | |
uses: golangci/golangci-lint-action@v6 | |
with: | |
version: latest | |
- name: govulncheck | |
run: | | |
go install golang.org/x/vuln/cmd/govulncheck@latest | |
govulncheck ./... | |
deploy: | |
name: Deploy to AWS Lambda | |
needs: [ 'tests', 'lint' ] | |
if: github.ref_name == 'main' || github.ref_name == 'develop' | |
environment: ${{ github.ref_name }} | |
runs-on: ubuntu-latest | |
concurrency: | |
group: deploy-${{ github.ref }}-${{ matrix.region }} | |
cancel-in-progress: false | |
strategy: | |
matrix: | |
region: [ us-east-1, us-west-2 ] | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Setup Node.js | |
uses: actions/setup-node@v4 | |
with: | |
node-version: "22" | |
- name: Install AWS CDK | |
run: npm install -g aws-cdk | |
- 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: ${{ matrix.region }} | |
- name: Build | |
run: CGO_ENABLED=0 go build -tags lambda.norpc -ldflags="-s -w" -o bootstrap ./lambda | |
- name: CDK Deploy | |
if: github.ref_name == 'develop' || github.ref_name == 'main' | |
env: | |
AWS_REGION: ${{ matrix.region }} | |
ENVIRONMENT: ${{ vars.STAGE }} | |
LAMBDA_ROLE: ${{ vars.LAMBDA_ROLE }} | |
API_KEY_TABLE: ${{ vars.API_KEY_TABLE }} | |
TOTP_TABLE: ${{ vars.TOTP_TABLE }} | |
WEBAUTHN_TABLE: ${{ vars.WEBAUTHN_TABLE }} | |
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} | |
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | |
run: cd cdk && cdk deploy --require-approval never | |
build-and-publish: | |
name: Build and Publish | |
needs: [ 'tests', 'lint' ] | |
if: github.ref_name == 'main' || github.ref_name == 'develop' | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Log in to Docker Hub | |
uses: docker/login-action@v3 | |
with: | |
username: ${{ secrets.DOCKERHUB_USERNAME }} | |
password: ${{ secrets.DOCKERHUB_TOKEN }} | |
- name: Log in to GitHub Container Registry | |
uses: docker/login-action@v3 | |
with: | |
registry: ghcr.io | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Extract metadata (tags, labels) for Docker | |
id: meta | |
uses: docker/metadata-action@v5 | |
with: | |
images: | | |
${{ vars.DOCKER_ORG }}/${{ github.event.repository.name }} | |
ghcr.io/${{ github.repository }} | |
tags: | | |
type=ref,event=branch | |
type=semver,pattern={{version}} | |
type=semver,pattern={{major.minor}} | |
type=semver,pattern={{major}} | |
- name: Build and push Docker image | |
uses: docker/build-push-action@v5 | |
with: | |
context: . | |
push: true | |
tags: ${{ steps.meta.outputs.tags }} | |
labels: ${{ steps.meta.outputs.labels }} |