-
Notifications
You must be signed in to change notification settings - Fork 25
165 lines (138 loc) · 4.99 KB
/
release.yml
File metadata and controls
165 lines (138 loc) · 4.99 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
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
name: Build & Release
on:
push:
branches: ["main"]
tags:
- "v*"
pull_request:
branches: ["main"]
types: [opened, synchronize, labeled, unlabeled]
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
env:
CARGO_TERM_COLOR: always
jobs:
check-version-changed:
runs-on: ubuntu-24.04
permissions:
contents: write
env:
CURRENT_TAG: ${{ github.ref_name }}
outputs:
RELEASE_NOTES: ${{ steps.versions.outputs.RELEASE_NOTES }}
steps:
- uses: actions/checkout@v4
- name: Check versions
id: versions
run: |
if [[ $CURRENT_TAG == 'main' ]]; then
echo "::notice::Tag $CURRENT_TAG is not a release tag, skipping the check in the main branch"
exit 0
fi
if [[ $CURRENT_TAG != "v"* ]]; then
echo "::notice::Tag $CURRENT_TAG is not a release tag, skipping the check in a PR"
exit 0
fi
export PKG_VER=v$(cat crates/resolc/Cargo.toml | grep -A 5 package] | grep version | cut -d '=' -f 2 | tr -d '"' | tr -d " ")
echo "Current tag $CURRENT_TAG"
echo "Package version $PKG_VER"
if [[ $CURRENT_TAG != $PKG_VER ]]; then
echo "::error::Tag $CURRENT_TAG doesn't match package version $PKG_VER in Cargo.toml, please fix"
exit 1
fi
export RELEASE_NOTES="$(sed '/^## '${CURRENT_TAG}'/,/^## v/!d' CHANGELOG.md | sed -e '1d' -e '$d')"
echo "Release notes:"
echo "$RELEASE_NOTES"
echo 'RELEASE_NOTES<<EOF' >> $GITHUB_OUTPUT
echo "$RELEASE_NOTES" >> $GITHUB_OUTPUT
echo 'EOF' >> $GITHUB_OUTPUT
build:
needs: [check-version-changed]
uses: ./.github/workflows/reusable-build.yml
with:
is_release: true
retention_days: 1
create-release:
if: startsWith(github.ref_name, 'v')
needs: [check-version-changed, build]
runs-on: macos-15
environment: tags
steps:
- name: Download Artifacts
uses: actions/download-artifact@v4
with:
merge-multiple: true
- name: Create macOS Fat Binary
run: |
lipo resolc-aarch64-apple-darwin resolc-x86_64-apple-darwin -create -output resolc-universal-apple-darwin
- name: Make Executable
run: |
chmod +x resolc-x86_64-unknown-linux-musl
chmod +x resolc-universal-apple-darwin
- name: Create sha-256 checksum
run: |
shasum -a 256 resolc-x86_64-unknown-linux-musl > checksums.txt
shasum -a 256 resolc-universal-apple-darwin >> checksums.txt
shasum -a 256 resolc-x86_64-pc-windows-msvc.exe >> checksums.txt
shasum -a 256 resolc.js >> checksums.txt
shasum -a 256 resolc.wasm >> checksums.txt
shasum -a 256 resolc_web.js >> checksums.txt
- uses: actions/create-github-app-token@v1
id: app-token
with:
app-id: ${{ secrets.REVIVE_RELEASE_APP_ID }}
private-key: ${{ secrets.REVIVE_RELEASE_APP_KEY }}
- name: create-release
uses: softprops/action-gh-release@v2
with:
body: |
## Changelog
${{ needs.check-version-changed.outputs.RELEASE_NOTES }}
## Note for macOS Users
The macOS binary is unsigned and it needs to be made runnable using `xattr -c resolc-universal-apple-darwin`.
tag_name: ${{ github.ref_name }}
name: ${{ github.ref_name }}
prerelease: true
token: ${{ steps.app-token.outputs.token }}
target_commitish: ${{ github.sha }}
files: |
resolc-x86_64-unknown-linux-musl
resolc-universal-apple-darwin
resolc-x86_64-pc-windows-msvc.exe
resolc.js
resolc.wasm
resolc_web.js
checksums.txt
npm-release:
needs: [create-release]
runs-on: macos-15
environment: tags
steps:
- uses: actions/checkout@v4
- name: Download Artifacts
uses: actions/download-artifact@v4
with:
merge-multiple: true
- name: Set Up Node.js
uses: actions/setup-node@v3
with:
node-version: "20"
- run: npm ci -w js/resolc
- name: Build
run: |
cp -f resolc.{wasm,js} js/resolc/src/resolc
npm -w js/resolc run build
- name: npm pack
run: npm -w js/resolc pack
- uses: actions/upload-artifact@v4
with:
name: npm_package
path: "parity-resolc-*.tgz"
- uses: octokit/request-action@bbedc70b1981e610d89f1f8de88311a1fc02fb83
with:
route: POST /repos/paritytech/npm_publish_automation/actions/workflows/publish.yml/dispatches
ref: main
inputs: '${{ format(''{{ "artifact_name": "npm_package", "repo": "{0}", "run_id": "{1}" }}'', github.repository, github.run_id) }}'
env:
GITHUB_TOKEN: ${{ secrets.NPM_PUBLISH_AUTOMATION_TOKEN }}