Skip to content

Bump docker/metadata-action from 4.6.0 to 5.0.0 #7

Bump docker/metadata-action from 4.6.0 to 5.0.0

Bump docker/metadata-action from 4.6.0 to 5.0.0 #7

Workflow file for this run

on:
push:
branches: [main]
tags: ["v*.*.*"]
pull_request:
types: [opened, reopened, synchronize]
jobs:
format-build-test:
strategy:
matrix:
go-version: ['1.19.x']
platform: [ubuntu-latest, macos-latest, windows-latest]
runs-on: ${{ matrix.platform }}
steps:
- uses: actions/checkout@755da8c3cf115ac066823e79a1e1788f8940201b # v3.2.0
- uses: actions/setup-go@6edd4406fa81c3da01a34fa6f6343087c207a568 # v3.5.0
with:
go-version: ${{ matrix.go-version }}
- if: matrix.platform == 'ubuntu-latest'
run: if [ "$(gofmt -s -l . | wc -l)" -gt 0 ]; then exit 1; fi
- run: go build -v ./...
- run: make test
docker-build-push:
if: github.event_name != 'pull_request'
needs: mysql-test
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
steps:
- uses: actions/checkout@755da8c3cf115ac066823e79a1e1788f8940201b # v3.2.0
with:
fetch-depth: 0
- uses: docker/login-action@465a07811f14bebb1938fbed4728c6a1ff8901fc # v2.2.0
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- uses: docker/setup-buildx-action@4c0219f9ac95b02789c1075625400b2acbff50b1 # v2.9.1
- uses: docker/metadata-action@96383f45573cb7f253c731d3b3ab81c87ef81934 # v5.0.0
id: meta
with:
images: |
ghcr.io/${{ github.repository }}
tags: |
type=ref,event=branch
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}
type=semver,pattern={{major}}
type=sha
- uses: docker/build-push-action@2eb1c1961a95fc15694676618e422e8ba1d63825 # v4.1.1
with:
context: .
push: true
file: Dockerfile.buildx
platforms: linux/amd64,linux/arm64,linux/arm
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
release-zips:
if: github.event_name != 'pull_request'
needs: mysql-test
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@755da8c3cf115ac066823e79a1e1788f8940201b # v3.2.0
with:
fetch-depth: 0
- uses: actions/setup-go@6edd4406fa81c3da01a34fa6f6343087c207a568 # v3.5.0
with:
go-version: '1.19'
- run: CGO_ENABLED=0 make release
- uses: actions/upload-artifact@v3
with:
name: release-zips
path: "*.zip"
mysql-test:
runs-on: 'ubuntu-latest'
needs: format-build-test
services:
mysql:
image: mysql:8.0
env:
MYSQL_RANDOM_ROOT_PASSWORD: yes
MYSQL_DATABASE: nanodep
MYSQL_USER: nanodep
MYSQL_PASSWORD: nanodep
ports:
- 3800:3306
options: --health-cmd="mysqladmin ping" --health-interval=5s --health-timeout=2s --health-retries=3
defaults:
run:
shell: bash
env:
MYSQL_PWD: nanodep
PORT: 3800
steps:
- uses: actions/checkout@755da8c3cf115ac066823e79a1e1788f8940201b # v3.2.0
- uses: actions/setup-go@6edd4406fa81c3da01a34fa6f6343087c207a568 # v3.5.0
with:
go-version: '1.19.x'
- name: verify mysql
run: |
while ! mysqladmin ping --host=localhost --port=$PORT --protocol=TCP --silent; do
sleep 1
done
- name: mysql schema
run: |
mysql --version
mysql --user=nanodep --host=localhost --port=$PORT --protocol=TCP nanodep < ./storage/mysql/schema.sql
- name: setup test dsn
run: echo "NANODEP_MYSQL_STORAGE_TEST_DSN=nanodep:nanodep@tcp(localhost:$PORT)/nanodep" >> $GITHUB_ENV
- run: go test -v ./storage/mysql