-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
54 additions
and
1 deletion.
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,52 @@ | ||
name: Bump Version | ||
# Increments the version using semver and saves it to version (text file) | ||
# Creates a tagged commit with using the new version | ||
on: | ||
workflow_call: | ||
inputs: | ||
type: | ||
description: Release type (should be major, minor or patch) | ||
required: true | ||
type: string | ||
ref: | ||
type: string | ||
default: ${{ github.ref }} | ||
outputs: | ||
new_version: | ||
value: ${{ jobs.bump.outputs.new_version }} | ||
jobs: | ||
bump: | ||
name: Bump Version | ||
runs-on: ubuntu-latest | ||
if: ${{ inputs.type != 'no_release' }} | ||
outputs: | ||
new_version: ${{ steps.increment_version.outputs.new_version }} | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v3 | ||
with: | ||
ref: ${{ inputs.ref }} | ||
|
||
- name: Install semver | ||
run: npm i semver -g | ||
|
||
- name: Increment the Runtime Version | ||
id: increment_version | ||
env: | ||
TYPE: ${{ inputs.type }} | ||
run: | | ||
CURRENT=$(cat version) | ||
NEW=$(semver -i $TYPE $CURRENT) | ||
echo $NEW > version | ||
echo "new_version=$NEW" >> $GITHUB_OUTPUT | ||
|
||
- name: Commit Change | ||
id: commit_version | ||
uses: EndBug/add-and-commit@v9 | ||
env: | ||
NEW_VERSION: ${{ steps.increment_version.outputs.new_version }} | ||
with: | ||
message: Update version ${{ env.NEW_VERSION }} | ||
tag: v${{ env.NEW_VERSION }} | ||
default_author: github_actions | ||
|
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
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 @@ | ||
1.0.0 |