Merge pull request #103 from cybozu-go/bump-v0.12.2 #26
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Release | |
on: | |
push: | |
tags: | |
- 'v*' | |
jobs: | |
release: | |
name: Release on GitHub | |
needs: image | |
runs-on: ubuntu-22.04 | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-go@v5 | |
with: | |
go-version-file: go.mod | |
- run: CGO_ENABLED=0 GOOS=linux GOARCH=amd64 make build/moco-agent | |
- name: Create Release | |
env: | |
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
run: | | |
VERSION=${GITHUB_REF#refs/tags/} # Don't remove "v" prefix. | |
if echo ${VERSION} | grep -q -e '-'; then PRERELEASE_FLAG=-p; fi | |
gh release create $VERSION $PRERELEASE_FLAG \ | |
-t "Release $VERSION" \ | |
-n "See [CHANGELOG.md](./CHANGELOG.md) for details." | |
gh release upload $VERSION ./build/moco-agent ./proto/agentrpc.proto | |
image: | |
name: Push Container Image | |
runs-on: ubuntu-22.04 | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up QEMU | |
uses: docker/setup-qemu-action@v3 | |
with: | |
platforms: linux/amd64,linux/arm64/v8 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v3 | |
- name: Login to GitHub Container Registry | |
uses: docker/login-action@v3 | |
with: | |
registry: ghcr.io | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Set Tag | |
id: set-tag | |
run: echo "RELEASE_TAG=${GITHUB_REF#refs/tags/v}" >> $GITHUB_OUTPUT # Remove "v" prefix. | |
- name: Build and push | |
uses: docker/build-push-action@v5 | |
with: | |
platforms: linux/amd64,linux/arm64/v8 | |
push: true | |
tags: ghcr.io/cybozu-go/moco-agent:${{ steps.set-tag.outputs.RELEASE_TAG }} |