Merge pull request #273 from cybozu-go/bump-2.5.2 #31
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*' | |
defaults: | |
run: | |
working-directory: v2 | |
env: | |
go-version: "1.20" | |
cache-version: 1 | |
jobs: | |
image: | |
name: Push container image | |
runs-on: ubuntu-22.04 | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-go@v4 | |
with: | |
go-version: ${{ env.go-version }} | |
- 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: Cache tools | |
id: cache-tools | |
uses: actions/cache@v3 | |
with: | |
path: | | |
v2/bin | |
v2/include | |
key: cache-${{ env.cache-version }}-go-${{ env.go-version }}-${{ hashFiles('v2/Makefile') }} | |
- run: make setup | |
if: steps.cache-tools.outputs.cache-hit != 'true' | |
- 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: | |
context: ./v2 | |
platforms: linux/amd64,linux/arm64/v8 | |
push: true | |
tags: ghcr.io/cybozu-go/coil:${{ steps.set-tag.outputs.RELEASE_TAG }} | |
release: | |
name: Release on GitHub | |
needs: image | |
runs-on: ubuntu-22.04 | |
steps: | |
- uses: actions/checkout@v4 | |
- 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." |