Skip to content
This repository has been archived by the owner on Jul 23, 2024. It is now read-only.

Bump docker/build-push-action from 5.3.0 to 6.2.0 #147

Bump docker/build-push-action from 5.3.0 to 6.2.0

Bump docker/build-push-action from 5.3.0 to 6.2.0 #147

Workflow file for this run

name: main
on:
push:
branches:
- main
tags:
- 'v*'
pull_request:
branches:
- '*'
jobs:
build:
name: Build
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
- name: Setup Go
uses: actions/setup-go@cdcb36043654635271a94b9a6d1392de5bb323a7 # v5.0.1
with:
go-version-file: 'go.mod'
- name: Download dependencies
run: |
go mod download
- name: Run unit tests
run: |
go test -v -race -coverprofile=coverage.txt -covermode=atomic $(go list ./...)
# TODO: enable after fixing linter issues
# - name: Run linter
# uses: golangci/golangci-lint-action@3a919529898de77ec3da873e3063ca4b10e7f5cc # v3.7.0
# with:
# version: v1.52.2
# args: --verbose
# # See: https://github.com/golangci/golangci-lint-action/issues/244
# skip-pkg-cache: true
# skip-build-cache: true
- name: Build
run: |
go build -v -o ./bin/envexec .
docker:
name: Docker
runs-on: ubuntu-latest
needs:
- build
env:
IMAGE_NAME: hypnoglow/envexec
# For PR, we only build for AMD64, just to be sure that Docker build works.
# For main branch and tags we also build for ARM64.
# Note that building for ARM64 is very slow.
IMAGE_PLATFORMS: |
linux/amd64
${{ github.event_name != 'pull_request' && 'linux/arm64' || '' }}
steps:
- name: Checkout
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
- name: Setup Go
uses: actions/setup-go@cdcb36043654635271a94b9a6d1392de5bb323a7 # v5.0.1
with:
go-version-file: 'go.mod'
- name: Download dependencies
run: |
go mod download
go mod vendor
- name: Login to Docker Hub
uses: docker/login-action@0d4c9c5ea7693da7b068278f7b52bda2a190a446 # v3.2.0
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
if: github.event_name != 'pull_request'
# Used for arm images.
- name: Set up QEMU
uses: docker/setup-qemu-action@68827325e0b33c7199eb31dd4e31fbe9023e06e3 # v3.0.0
with:
platforms: ${{ env.IMAGE_PLATFORMS }}
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@d70bba72b1f3fd22344832f00baa16ece964efeb # v3.3.0
- name: Extract Docker image metadata (alpine)
id: docker_meta_alpine
uses: docker/metadata-action@8e5442c4ef9f78752691e2d8f8d19755c6f78e81 # v5.5.1
with:
images: |
${{ env.IMAGE_NAME }}
flavor: |
suffix=-alpine
tags: |
type=ref,event=pr
type=ref,event=branch,enable={{ is_default_branch }}
type=semver,pattern={{ version }}
- name: Extract Docker image metadata (scratch)
id: docker_meta_scratch
uses: docker/metadata-action@8e5442c4ef9f78752691e2d8f8d19755c6f78e81 # v5.5.1
with:
images: |
${{ env.IMAGE_NAME }}
flavor: |
suffix=-scratch
tags: |
type=ref,event=pr
type=ref,event=branch,enable={{ is_default_branch }}
type=semver,pattern={{ version }}
- name: Build and push Docker image (alpine)
uses: docker/build-push-action@15560696de535e4014efeff63c48f16952e52dd1 # v6.2.0
with:
file: docker/alpine/Dockerfile
context: .
platforms: ${{ env.IMAGE_PLATFORMS }}
tags: ${{ steps.docker_meta_alpine.outputs.tags }}
labels: ${{ steps.docker_meta_alpine.outputs.labels }}
push: ${{ github.event_name != 'pull_request' }}
- name: Build and push Docker image (scratch)
uses: docker/build-push-action@15560696de535e4014efeff63c48f16952e52dd1 # v6.2.0
with:
file: docker/scratch/Dockerfile
context: .
platforms: ${{ env.IMAGE_PLATFORMS }}
tags: ${{ steps.docker_meta_scratch.outputs.tags }}
labels: ${{ steps.docker_meta_scratch.outputs.labels }}
push: ${{ github.event_name != 'pull_request' }}
goreleaser:
name: GoReleaser
runs-on: ubuntu-latest
needs:
- build
permissions:
contents: write
if: startsWith(github.ref, 'refs/tags/')
steps:
- name: Checkout
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
with:
fetch-depth: 0
- name: Setup Go
uses: actions/setup-go@cdcb36043654635271a94b9a6d1392de5bb323a7 # v5.0.1
with:
go-version-file: 'go.mod'
- name: Download dependencies
run: |
go mod download
- name: Run GoReleaser
uses: goreleaser/goreleaser-action@286f3b13b1b49da4ac219696163fb8c1c93e1200 # v6.0.0
with:
version: latest
args: release --clean
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GORELEASER_PREVIOUS_TAG: ""