-
-
Notifications
You must be signed in to change notification settings - Fork 756
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Move bump logic to a PR * Missing parameter, and workflow fix * Fix release output * Better names * Better name for output * Update docs about release
- Loading branch information
Showing
3 changed files
with
81 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
name: Create bump version PR | ||
|
||
on: | ||
workflow_dispatch: | ||
inputs: | ||
version: | ||
description: Version to change to. | ||
required: true | ||
type: string | ||
|
||
jobs: | ||
bump-version-pr: | ||
name: Bump version PR | ||
runs-on: ubuntu-latest | ||
defaults: | ||
run: | ||
shell: bash | ||
steps: | ||
|
||
- uses: actions/checkout@v4 | ||
with: | ||
fetch-depth: 0 | ||
ref: main | ||
|
||
- name: Use Node.js from nvmrc | ||
uses: actions/setup-node@v4 | ||
with: | ||
node-version-file: '.nvmrc' | ||
|
||
- name: Bump version | ||
run: | | ||
npm version --commit-hooks false --git-tag-version false ${{ inputs.version }} | ||
./build/bump-version-changelog.js ${{ inputs.version }} | ||
- name: Create Pull Request | ||
uses: peter-evans/create-pull-request@v5 | ||
with: | ||
commit-message: Bump version to ${{ inputs.version }} | ||
branch: bump-version-to-${{ inputs.version }} | ||
title: Bump version to ${{ inputs.version }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,22 +1,44 @@ | ||
name: Release | ||
|
||
on: | ||
push: | ||
branches: [main] | ||
workflow_dispatch: | ||
inputs: | ||
version: | ||
description: Version to change to. | ||
required: true | ||
type: string | ||
|
||
jobs: | ||
release: | ||
name: Release | ||
release-check: | ||
name: Check if version changed | ||
runs-on: ubuntu-latest | ||
defaults: | ||
run: | ||
shell: bash | ||
steps: | ||
- uses: actions/checkout@v4 | ||
with: | ||
fetch-depth: 0 | ||
ref: main | ||
|
||
- name: Use Node.js from nvmrc | ||
uses: actions/setup-node@v4 | ||
with: | ||
node-version-file: '.nvmrc' | ||
|
||
- name: Check if version changed | ||
id: check | ||
uses: EndBug/version-check@v2 | ||
|
||
outputs: | ||
publish: ${{ steps.check.outputs.changed }} | ||
|
||
release-publish: | ||
name: Publish to NPM and GitHub | ||
needs: release-check | ||
if: ${{ needs.release-check.outputs.publish == 'true' }} | ||
runs-on: ubuntu-latest | ||
defaults: | ||
run: | ||
shell: bash | ||
steps: | ||
- uses: actions/checkout@v4 | ||
with: | ||
fetch-depth: 0 | ||
|
@@ -27,24 +49,24 @@ jobs: | |
with: | ||
node-version-file: '.nvmrc' | ||
|
||
- name: Bump version | ||
run: | | ||
npm version --commit-hooks false --git-tag-version false ${{ inputs.version }} | ||
./build/bump-version-changelog.js | ||
- name: Commit and push version bump with a tag | ||
uses: stefanzweifel/git-auto-commit-action@v5 | ||
- name: Get version | ||
id: package-version | ||
uses: martinbeentjes/npm-get-version[email protected] | ||
|
||
- name: Tag commit and push | ||
uses: mathieudutour/github-tag-action@v6.1 | ||
with: | ||
commit_message: Bump version to ${{ inputs.version }} | ||
tagging_message: ${{ inputs.version }} | ||
github_token: ${{ secrets.GITHUB_TOKEN }} | ||
custom_tag: ${{ steps.package-version.outputs.current-version }} | ||
|
||
- name: Install | ||
run: npm ci | ||
|
||
- name: Prepare release | ||
id: prepare_release | ||
run: | | ||
echo "version_tag=v${{ inputs.version }}" >> $GITHUB_OUTPUT | ||
RELEASE_TYPE=$(node -e "console.log(require('semver').prerelease('${{ inputs.version }}') ? 'prerelease' : 'regular')") | ||
echo "version_tag=v${{ steps.package-version.outputs.current-version }}" >> $GITHUB_OUTPUT | ||
RELEASE_TYPE=$(node -e "console.log(require('semver').prerelease('${{ steps.package-version.outputs.current-version }}') ? 'prerelease' : 'regular')") | ||
echo "release_type=$RELEASE_TYPE" >> $GITHUB_OUTPUT | ||
- name: Build | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters