-
Notifications
You must be signed in to change notification settings - Fork 0
72 lines (65 loc) · 2.28 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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
---
name: Release
on:
workflow_dispatch:
inputs:
tag:
description: "Tag"
required: true
default: ""
prerelease:
type: choice
description: "Pre-Release?"
required: true
options:
- true
- false
default: true
jobs:
release:
runs-on: ubuntu-latest
env:
PRERELEASE: ${{ github.event.inputs.prerelease }}
steps:
- name: Checkout
uses: actions/checkout@v4
with:
ref: ${{ github.ref_name }}
- name: Fetch tags
run: |
# Cannot use `fetch-tags: true` due to:
# https://github.com/actions/checkout/issues/1471
git fetch --prune --unshallow --tags
- name: Tag
run: |
if ! [[ ${{ github.event.inputs.tag }} =~ ^v[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
echo "Tag needs to be vX.Y.Z, e.g. v1.2.3"
exit 1
fi
git tag ${{ github.event.inputs.tag }}
git push origin ${{ github.event.inputs.tag }}
# Create library git tag a la `lib/v0.1.1` for `go get`
LIB_TAG=$(grep "github.com/planetmint/planetmint-go/lib v[0-9]*\.[0-9]*\.[0-9]*" go.mod|sed "s#.*github.com/planetmint/planetmint-go/##g"|sed "s# #/#g")
if [[ $(git tag|grep ${LIB_TAG}|wc -l) -eq 0 ]]; then
git tag ${LIB_TAG}
git push origin ${LIB_TAG}
fi
- name: Setup Go
uses: actions/setup-go@v5
- name: Build
run: |
go build -ldflags="-s -w
-X 'github.com/cosmos/cosmos-sdk/version.Name=Planetmint Go'
-X 'github.com/cosmos/cosmos-sdk/version.AppName=planetmint-god'
-X 'github.com/cosmos/cosmos-sdk/version.Version=${{ github.event.inputs.tag }}'
-X 'github.com/cosmos/cosmos-sdk/version.Commit=$(git rev-list HEAD|head -n1)'
-X 'github.com/cosmos/cosmos-sdk/version.BuildTags=linux amd64'" -v ./cmd/planetmint-god
- name: Release
uses: softprops/action-gh-release@v1
with:
prerelease: ${{ fromJSON(env.PRERELEASE) }}
files: planetmint-god
name: ${{ github.event.inputs.tag }}
tag_name: ${{ github.event.inputs.tag }}
fail_on_unmatched_files: true
generate_release_notes: true