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

Update docker/metadata-action action to v5 #166

Update docker/metadata-action action to v5

Update docker/metadata-action action to v5 #166

Workflow file for this run

name: Test & Build
on: push
jobs:
test:
name: Test
runs-on: ubuntu-latest
env:
GOEXPERIMENT: loopvar
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v4
with:
go-version: 1.x
check-latest: true
- name: Get dependencies
run: |
go get -v -t -d ./...
- name: Vet
run: go vet ./...
- name: Test
run: go test ./...
build:
name: Build
runs-on: ubuntu-latest
if: ${{ github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/tags/') }}
needs:
- test
permissions:
contents: read # required for checkout
id-token: write # mint AWS credentials through OIDC
packages: write
strategy:
fail-fast: false
matrix:
include:
- dockerfile: Dockerfile
image_name: source-template
env:
GOEXPERIMENT: loopvar
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Docker meta
id: meta
uses: docker/metadata-action@v5
with:
images: ghcr.io/overmindtech/${{ matrix.image_name }}
tags: |
type=ref,event=branch
type=ref,event=pr
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}
- name: Login to GitHub Container Registry
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Set up Docker Buildx
id: setup-builder
uses: docker/setup-buildx-action@v2
- name: Build and push
id: push
uses: docker/build-push-action@v4
with:
builder: ${{ steps.setup-builder.outputs.name }}
context: .
cache-from: type=gha
cache-to: type=gha,mode=max
file: build/package/${{ matrix.dockerfile }}
push: ${{ github.event_name != 'pull_request' }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}