-
Notifications
You must be signed in to change notification settings - Fork 1
109 lines (97 loc) · 3.21 KB
/
Copy pathrelease.yml
File metadata and controls
109 lines (97 loc) · 3.21 KB
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
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
name: Release
on:
push:
tags:
- "v*"
permissions:
contents: write # required by goreleaser to create releases
concurrency:
group: release-${{ github.ref }}
cancel-in-progress: false
jobs:
goreleaser:
# macOS runner is required for codesign on the darwin binary.
# Goreleaser cross-compiles Linux and Windows targets from here;
# nfpm (deb/rpm) is pure Go and works from any host.
runs-on: macos-latest
steps:
- name: Checkout
uses: actions/checkout@v6
with:
fetch-depth: 0 # full history for the changelog
- name: Set up Go
uses: actions/setup-go@v6
with:
go-version-file: go.mod
cache: true
- name: Run GoReleaser
uses: goreleaser/goreleaser-action@v7
with:
distribution: goreleaser
version: "~> v2"
args: release --clean
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# Uncomment and set HOMEBREW_TAP_GITHUB_TOKEN after enabling the
# brews: section in .goreleaser.yaml.
# HOMEBREW_TAP_GITHUB_TOKEN: ${{ secrets.HOMEBREW_TAP_GITHUB_TOKEN }}
- name: Upload dist artifacts
if: always()
uses: actions/upload-artifact@v7
with:
name: release-dist
path: |
dist/*.tar.gz
dist/*.zip
dist/*.deb
dist/*.rpm
dist/*_checksums.txt
if-no-files-found: warn
retention-days: 30
bump-readme:
needs: goreleaser
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Checkout main
uses: actions/checkout@v6
with:
ref: main
fetch-depth: 1
- name: Bump install URLs in README
env:
TAG: ${{ github.ref_name }}
run: |
set -euo pipefail
VERSION="${TAG#v}"
# Rewrite stable or pre-release version links to the new stable tag.
sed -i -E "s|releases/download/v[0-9]+\.[0-9]+\.[0-9]+(-[0-9A-Za-z.-]+)?/|releases/download/${TAG}/|g" README.md
sed -i -E "s|stakecli_[0-9]+\.[0-9]+\.[0-9]+(-[0-9A-Za-z.-]+)?_|stakecli_${VERSION}_|g" README.md
sed -i -E "s|STAKECLI_VERSION = \"v[0-9]+\.[0-9]+\.[0-9]+(-[0-9A-Za-z.-]+)?\"|STAKECLI_VERSION = \"${TAG}\"|g" README.md
- name: Commit and push
env:
TAG: ${{ github.ref_name }}
run: |
set -euo pipefail
if git diff --quiet README.md; then
echo "README already up to date for ${TAG}"
exit 0
fi
git config user.name "github-actions[bot]"
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
git add README.md
git commit -m "chore(release): bump install URLs to ${TAG}"
git push origin main
publish-accelerator-installer:
needs: goreleaser
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- uses: actions/checkout@v6
- name: Upload standalone accelerator installer
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
TAG: ${{ github.ref_name }}
run: gh release upload "${TAG}" scripts/install-accelerator.sh --clobber