Skip to content

Merge pull request #261 from databacker/ci-workflow-go-1.21 #11

Merge pull request #261 from databacker/ci-workflow-go-1.21

Merge pull request #261 from databacker/ci-workflow-go-1.21 #11

Workflow file for this run

name: Release
on:
push:
tags:
- 'v*'
env:
IMAGE_NAME: databack/mysql-backup
jobs:
report:
name: Report
runs-on: ubuntu-latest
steps:
- name: ref
run: echo ${{ github.ref }}
- name: event_name
run: echo ${{ github.event_name }}
release:
name: Release
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Set up Go
uses: actions/setup-go@v1
with:
go-version: 1.21
- name: Build with xgo
uses: crazy-max/ghaction-xgo@v3
with:
xgo_version: latest
go_version: 1.21
dest: dist
targets: windows/386,windows/amd64,windows/arm64,linux/386,linux/amd64,linux/arm64,darwin/amd64,darwin/arm64
v: true
x: true
ldflags: -s -w
- name: Release
uses: softprops/action-gh-release@v1
with:
files: |
dist/*
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Login to DockerHub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
- name: Docker meta
id: meta
uses: docker/metadata-action@v5
with:
# list of Docker images to use as base name for tags
images: |
${{env.IMAGE_NAME}}
# generate Docker tags based on the following events/attributes
# for any semver, including rc and alpha, etc. take the tag as is
# for ones that are exactly X.Y.Z, also tag it as latest
tags: |
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}.{{patch}},value=latest
- name: Build and push semver tag
id: docker_build_push_semver
uses: docker/build-push-action@v2
with:
push: true
platforms: linux/amd64,linux/arm64
tags: |
${{ steps.meta.outputs.tags }}