generated from cybozu-go/neco-template
-
Notifications
You must be signed in to change notification settings - Fork 5
52 lines (52 loc) · 1.7 KB
/
release.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
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 }}