Skip to content

Commit

Permalink
Update action runtime to Node 20 (#70)
Browse files Browse the repository at this point in the history
* Update workflows to latest action versions

* Update action to node20 and changelog

* Rename create release action inputs and outputs
  • Loading branch information
richtea authored Feb 4, 2024
1 parent 2264c46 commit 37dfffd
Show file tree
Hide file tree
Showing 7 changed files with 49 additions and 18 deletions.
10 changes: 5 additions & 5 deletions .github/workflows/check-dist.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,12 @@ jobs:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4

- name: Set Node.js 16.x
uses: actions/setup-node@v3
- name: Set Node.js version
uses: actions/setup-node@v4
with:
node-version: 16.x
node-version-file: '.nvmrc'

- name: Install dependencies
run: npm ci
Expand All @@ -43,7 +43,7 @@ jobs:
id: diff

# If index.js was different than expected, upload the expected version as an artifact
- uses: actions/upload-artifact@v2
- uses: actions/upload-artifact@v4
if: ${{ failure() && steps.diff.conclusion == 'failure' }}
with:
name: dist
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ jobs:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version-file: '.nvmrc'
- run: npm ci
Expand All @@ -30,7 +30,7 @@ jobs:
fi
# If index.js was different than expected, upload the expected version as an artifact
- uses: actions/upload-artifact@v2
- uses: actions/upload-artifact@v4
if: ${{ failure() && steps.diff.conclusion == 'failure' }}
with:
name: dist
Expand Down
33 changes: 26 additions & 7 deletions .github/workflows/pr-merged.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,16 @@ on:

name: '[autorelease] PR merged'

permissions:
contents: read
pull-requests: write

jobs:
merge:
runs-on: ubuntu-latest
if: github.event.pull_request.merged == true && contains(github.event.pull_request.labels.*.name, 'autorelease')
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4

- name: Get release version
id: get-release-version
Expand All @@ -23,10 +27,25 @@ jobs:
fi
VERSION=$(echo "${{ github.event.pull_request.head.ref }}" | awk -F/ '{print $2}')
echo "VERSION=$VERSION"
RE='^[vV]?([0-9]+)[.]([0-9]+)[.]([0-9]+)(-[0-9A-Za-z.+-]*)?'
if [[ $VERSION =~ $RE ]]; then
MAJOR="${BASH_REMATCH[1]}"
MINOR="${BASH_REMATCH[2]}"
PATCH="${BASH_REMATCH[3]}"
PRERELEASE="${BASH_REMATCH[4]}"
else
echo "::error::Version '$VERSION' is not in a valid format" && exit 1
fi
if [[ "$PRERELEASE" ]]; then pre=true; else pre=false; fi
if [[ -f $GITHUB_OUTPUT ]]; then
echo "release-version=$VERSION" >> $GITHUB_OUTPUT
echo "is-prerelease=$pre" >> $GITHUB_OUTPUT
else
echo "::set-output name=release-version::$VERSION"
echo "::set-output name=is-prerelease::$pre"
fi
- name: Get release notes
Expand All @@ -42,16 +61,16 @@ jobs:
- name: Create Draft Release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
uses: release-flow/.github/actions/release/create@v1
with:
tag_name: 'v${{ steps.get-release-version.outputs.release-version }}'
release_name: 'Release ${{ steps.get-release-version.outputs.release-version }}'
github-token: ${{ secrets.GITHUB_TOKEN }}
tag-name: 'v${{ steps.get-release-version.outputs.release-version }}'
release-name: 'Release ${{ steps.get-release-version.outputs.release-version }}'
draft: true
prerelease: ${{ steps.get-release-version.outputs.is-prerelease}}
body: ${{ steps.get-release-notes.outputs.release-notes }}

- name: Display Instructions
run: |
echo "::notice title=Draft Release Prepared::A draft release has been prepared for you to approve: ${{ steps.create_release.outputs.html_url }}"
echo "::notice title=Draft Release Prepared::A draft release has been prepared for you to approve: ${{ steps.create_release.outputs.html-url }}"
6 changes: 5 additions & 1 deletion .github/workflows/prepare-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,10 @@ on:

name: '[autorelease] Prepare release PR'

permissions:
contents: read
issues: write

jobs:
changelog:
name: Update changelog and create PR
Expand Down Expand Up @@ -57,7 +61,7 @@ jobs:

- name: Create Pull Request
id: create-release-pr
uses: peter-evans/create-pull-request@v4
uses: peter-evans/create-pull-request@v6
with:
commit-message: 'chore: Update changelog for release ${{ steps.update-changelog.outputs.version }}'
committer: 'releasebot <noreply@github.com>'
Expand Down
2 changes: 1 addition & 1 deletion .nvmrc
Original file line number Diff line number Diff line change
@@ -1 +1 @@
v16.14.0
v20.11.0
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,14 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](http://keepachangelog.com/)
and this project adheres to [Semantic Versioning](http://semver.org/).

## [Unreleased]

### Changed

- Update this action to use Node 20.

- Update all workflows to latest version of GH actions.

## [2.2.1] - 2023-03-11

### Changed
Expand Down
2 changes: 1 addition & 1 deletion action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -68,5 +68,5 @@ outputs:
The final part of the release heading, after the version and date have been parsed. For example, if the release
heading is '## [0.0.5] - 2014-12-13 [YANKED]', this output would contain '[YANKED]'.
runs:
using: 'node16'
using: 'node20'
main: dist/index.js

0 comments on commit 37dfffd

Please sign in to comment.