Skip to content

Fix release flow

Fix release flow #4

Workflow file for this run

name: Release
on:
push:
tags:
- "v*"
pull_request:
jobs:
image:
name: Push Container Image
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v4
with:
go-version-file: "go.mod"
- uses: docker/setup-qemu-action@v3
with:
platforms: linux/amd64
- uses: docker/setup-buildx-action@v3
- name: Login to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build necoperf-cli and necoperf-daemon image
run: make docker-build
- name: Push necoperf-cli and necoperf-daemon image
if: github.event_name != 'pull_request'
run: |
IMAGE_TAG=${GITHUB_REF#refs/tags/v} # Remove "v" prefix.
docker tag necoperf-cli:dev ghcr.io/cybozu-go/necoperf-cli:$IMAGE_TAG
docker push ghcr.io/cybozu-go/necoperf-cli:$IMAGE_TAG
docker tag necoperf-daemon:dev ghcr.io/cybozu-go/necoperf-daemon:$IMAGE_TAG
docker push ghcr.io/cybozu-go/necoperf-daemon:$IMAGE_TAG
release:
name: Release on GitHub
needs: image
runs-on: ubuntu-22.04
permissions:
contents: write
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v4
with:
go-version-file: "go.mod"
- name: GoReleaser
uses: goreleaser/goreleaser-action@v5
if: github.event_name != 'pull_request'
with:
distribution: goreleaser
version: latest
args: release --clean
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}