Update gomod updates (#15) #52
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@11bd71901bbe5b1630ceea73d27597364c9af683 # v4 | ||
- uses: actions/setup-go@3041bf56c941b39c61721a86cd11f3bb1338122a # v5 | ||
- uses: hadolint/hadolint-action@54c9adbab1582c2ef04b2016b760714a4bfde3cf # v3.1.0 | ||
- name: golangci-lint | ||
uses: golangci/golangci-lint-action@971e284b6050e8a5849b72094c50ab08da042db8 # v6 | ||
with: | ||
version: latest | ||
- name: Install dependencies | ||
run: go get . | ||
- 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@11bd71901bbe5b1630ceea73d27597364c9af683' # v4 | ||
- name: Extract branch name | ||
shell: bash | ||
shell: bash | ||
run: |- | ||
BRANCH=$(echo "${GITHUB_REF#refs/heads/}" | sed 's/[^a-zA-Z0-9._-]//g' | awk '{print substr($0, length($0)-120)}') | ||
echo "branch=$BRANCH" >> $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@3a3c4c57d294ef65efaaee4ff17b22fa88dd3c69' # 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@9780b0c442fbb1117ed29e0efdff1e18412f7567' # 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@48aba3b46d1b1fec4febb7c5d0c644b249a11355 # v6 | ||
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}} |