Skip to content

Release notes for v0.3.0 #5

Release notes for v0.3.0

Release notes for v0.3.0 #5

Workflow file for this run

name: '[CI/CD] Release'
# Only release when a new GH release branch is pushed
on:
push:
branches:
- 'release/v[0-9]+.[0-9]+.[0-9]+'
jobs:
build:
runs-on: ubuntu-latest
env:
image_name: docker.io/juanariza131/api-mock
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set up Go
uses: actions/setup-go@v4
with:
go-version: '1.21.1'
# Setup env for multi-arch builds
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
# Tag for GoReleaser from release branch name
- name: Tag Release
run: |
RELEASE_BRANCH="${{ github.ref }}"
VERSION_TAG=$(echo "$RELEASE_BRANCH" | awk -F'/' '{print $NF}')
echo "VERSION_TAG=$VERSION_TAG" >> $GITHUB_ENV
git tag "$VERSION_TAG"
# Build & Release binaries
- name: Run GoReleaser
uses: goreleaser/goreleaser-action@v5
if: success() && startsWith(github.ref, 'refs/heads/')
with:
distribution: goreleaser
version: v1.21.2
args: release --clean
env:
GITHUB_TOKEN: ${{ secrets.GH_TOKEN }}
# Build & Publish multi-arch image
- name: Login to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Extract metadata (tags, labels) for Docker controller image
id: meta
uses: docker/metadata-action@v5
with:
images: |
${{ env.image_name }}
tags: |
type=raw,value=${{ env.VERSION_TAG }}
type=raw,value=latest
- name: Build and push controller image
id: docker_build_controller
uses: docker/build-push-action@v5
with:
context: .
file: ./Dockerfile
platforms: linux/amd64,linux/arm64,linux/arm
push: true
tags: ${{ steps.meta.outputs.tags }}