-
Notifications
You must be signed in to change notification settings - Fork 3
52 lines (48 loc) · 1.42 KB
/
bump-version.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
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