Skip to content

Commit

Permalink
ci: update workflows
Browse files Browse the repository at this point in the history
- use node 16.9
- adda  script to extract changelog
  • Loading branch information
Conaclos committed Sep 15, 2023
1 parent e50a3b0 commit 5a2f848
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 11 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,10 @@ jobs:
contents: read
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4
- uses: actions/setup-node@v3
with:
node-version: "14.18"
node-version: "16.9"
cache: npm
- name: Build and test coverage
run: |
Expand Down
14 changes: 5 additions & 9 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,17 +7,15 @@ jobs:
test:
uses: ./.github/workflows/ci.yml
release:
# based on esbuild release script (MIT licensed):
# https://github.com/evanw/esbuild/blob/master/.github/workflows/release.yml
needs: test
permissions:
contents: write
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- uses: actions/setup-node@v3
with:
node-version: "14.18"
node-version: "16.9"
cache: npm
- name: Build
run: |
Expand All @@ -26,14 +24,12 @@ jobs:
- name: Extract changelog
run: |
VERSION="${GITHUB_REF_NAME#v}"
CHANGELOG="$(awk -v ver="$VERSION" '/^## / { if (p) { exit }; if ($2 == ver) { p=1; next} } p' CHANGELOG.md)"
echo "CHANGELOG<<EOF" >> $GITHUB_ENV
echo "$CHANGELOG" >> $GITHUB_ENV
echo "EOF" >> $GITHUB_ENV
sh scripts/print-changelog.sh "$VERSION" >| ${{ github.workspace }}/RELEASE_NOTES
- name: Create GitHub Release
uses: softprops/action-gh-release@v1
with:
body: ${{ env.CHANGELOG }}
body_path: ${{ github.workspace }}/RELEASE_NOTES
prerelease: true
fail_on_unmatched_files: true
files: |
./dist/bare
13 changes: 13 additions & 0 deletions scripts/print-changelog.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
#!/bin/sh
set -eu

# Print a changelog section (default: first section).

VERSION=''
if test -n "${1:-}" && grep -Eq "^## $1($| )" CHANGELOG.md; then
# The specified version has a dedicated section in the changelog
VERSION="$1"
fi

# print Changelog of $VERSION
awk -v version="$VERSION" '/^## / { if (p) { exit }; if (version == "" || $2 == version) { p=1; next} } p' CHANGELOG.md

0 comments on commit 5a2f848

Please sign in to comment.