Close #13 - add link in Google Sheets to the GitHub workflow UI #102
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: 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@v6 | |
with: | |
version: latest | |
- name: Install dependencies | |
run: go get . | |
- name: Build | |
run: shellcheck **/*.sh | |
- name: Build | |
run: go build | |
- name: Test with the Go CLI | |
run: go test -v ./... | |
build-push: | |
needs: [lint-test] | |
runs-on: ubuntu-latest | |
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 }}/public/fabricator:${{steps.extract_branch.outputs.branch}}-${{steps.extract_tag.outputs.tag}} | |
us-docker.pkg.dev/${{ secrets.GCLOUD_PROJECT }}/public/fabricator:${{steps.extract_branch.outputs.branch}} | |