-
Notifications
You must be signed in to change notification settings - Fork 1
58 lines (45 loc) · 1.46 KB
/
reusable-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
53
54
55
56
57
58
name: Reusable bump-version workflow
on:
workflow_call:
inputs:
default_bump:
type: string
default: patch
outputs:
version:
value: ${{ jobs.bump-version.outputs.version }}
description: The new published version
is_prerelease:
value: ${{ jobs.bump-version.outputs.is_prerelease }}
description: Whether the version is a pre-release or not
jobs:
bump-version:
runs-on: ubuntu-latest
outputs:
version: ${{ steps.bump.outputs.new_tag }}
is_prerelease: ${{ steps.pre.outputs.is_prerelease }}
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Define default branch
run: |
if [[ "${{ github.event_name }}" == "pull_request" ]]; then
echo "DEFAULT_BRANCH=${{ github.head_ref }}" >> $GITHUB_ENV
fi
- name: Bump version and push tag
id: bump
uses: anothrNick/[email protected]
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
WITH_V: false
INITIAL_VERSION: 0.1.0
RELEASE_BRANCHES: main
PRERELEASE: true
DEFAULT_BUMP: ${{ inputs.default_bump }}
- name: Check pre-release
id: pre
run: |
[[ "$TAG" =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]] && is_prerelease=false || is_prerelease=true
echo "is_prerelease=${is_prerelease}" >> $GITHUB_OUTPUT
env:
TAG: ${{ steps.bump.outputs.new_tag }}