-
Notifications
You must be signed in to change notification settings - Fork 57
54 lines (43 loc) · 1.62 KB
/
release.yml
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
name: CREATE_RELEASE
on:
workflow_dispatch:
jobs:
create-release:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 20
cache: 'yarn'
- run: yarn
- run: echo "//registry.npmjs.org/:_authToken=${{ secrets.NPM_TOKEN }}" > ~/.npmrc
- name: Extract version from package.json
id: package_version
run: echo "VERSION=$(jq -r .version package.json)" >> $GITHUB_ENV
- name: Check for changelog entry
id: changelog
run: |
VERSION=${{ env.VERSION }}
echo "Searching for version: $VERSION in CHANGELOG.md"
CHANGELOG_OUTPUT=$(yarn changelog --stdout)
NOTES=$(echo "$CHANGELOG_OUTPUT" | awk "/\/${VERSION//./\\.} \(/ {print; flag=1; next} /^solidity-utils\// {flag=0} flag")
echo "$CHANGELOG_OUTPUT" | awk "/\/${VERSION//./\\.} \(/
echo "$CHANGELOG_OUTPUT" | awk "/\/${VERSION//./\\.} \(/ {print; flag=1; next} /^solidity-utils\// {flag=0} flag"
if [ -z "$NOTES" ]; then
echo "❌ No changelog entry found for version $VERSION"
echo "Use: yarn changelog"
exit 1
fi
echo "::set-output name=notes::$NOTES"
shell: bash
- name: Create GitHub Release
uses: softprops/action-gh-release@v1
with:
tag_name: ${{ env.VERSION }}
name: Release ${{ env.VERSION }}
body: ${{ steps.changelog.outputs.notes }}
draft: false
prerelease: false
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}