Update to Go v1.21 #442
Workflow file for this run
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: Test and Build | |
on: | |
push: | |
branches: | |
- main | |
pull_request: | |
workflow_dispatch: | |
jobs: | |
test-build: | |
name: test-build | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3.1.0 | |
- uses: actions/setup-go@v2 | |
with: | |
go-version: ^1.21 | |
- name: Test | |
run: make test | |
- name: Build | |
run: make build | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v2 | |
- name: Docker meta | |
id: meta | |
uses: docker/metadata-action@v4 | |
with: | |
# list of Docker images to use as base name for tags | |
images: | | |
ghcr.io/${{ github.repository }} | |
# generate Docker tags based on the following events/attributes | |
tags: | | |
type=ref,event=pr | |
type=semver,pattern={{raw}} | |
type=sha | |
- name: Login to GitHub Packages | |
if: github.event_name != 'pull_request' | |
uses: docker/login-action@v2.1.0 | |
with: | |
registry: ghcr.io | |
username: ${{ github.repository_owner }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Build and publish a docker image | |
uses: docker/build-push-action@v4.0.0 | |
with: | |
platforms: linux/amd64,linux/arm64 | |
push: ${{ github.event_name != 'pull_request' }} | |
tags: ${{ steps.meta.outputs.tags }} | |
labels: ${{ steps.meta.outputs.labels }} |