Skip to content

lint

lint #5

name: lint-test
on: [push]
permissions:
contents: read
jobs:
lint-test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v4
- name: golangci-lint
uses: golangci/golangci-lint-action@v3
with:
version: v1.54
- name: Install dependencies
run: go get .
- name: Build
run: go build -v ./...
- name: Test with the Go CLI
run: go test -v ./...
build-push:
needs: [lint-test]
runs-on: ubuntu-latest
timeout-minutes: 15
permissions:
contents: read
id-token: write
steps:
- uses: 'actions/checkout@v4'
- name: Extract branch name
shell: bash
run: echo "branch=${GITHUB_REF#refs/heads/}" >> $GITHUB_OUTPUT
id: extract_branch
- name: Extract tag name
shell: bash
run: |-
t=$(echo ${GITHUB_SHA} | cut -c1-7)
echo "tag=$t" >> $GITHUB_OUTPUT
id: extract_tag
- id: 'auth'
name: 'Authenticate to Google Cloud'
uses: 'google-github-actions/auth@v1'
with:
workload_identity_provider: ${{ secrets.GCLOUD_OIDC_POOL }}
create_credentials_file: true
service_account: ${{ secrets.GSA }}
token_format: 'access_token'
- uses: 'docker/login-action@v3'
name: 'Docker login'
with:
registry: 'us-docker.pkg.dev'
username: 'oauth2accesstoken'
password: '${{ steps.auth.outputs.access_token }}'
- name: Build and push
uses: docker/build-push-action@v5
with:
context: .
push: true
tags: |
us-docker.pkg.dev/${{ secrets.GCLOUD_PROJECT }}/internal/rollout:${{steps.extract_branch.outputs.branch}}-${{steps.extract_tag.outputs.tag}}
us-docker.pkg.dev/${{ secrets.GCLOUD_PROJECT }}/internal/rollout:${{steps.extract_branch.outputs.branch}}