-
Notifications
You must be signed in to change notification settings - Fork 0
64 lines (62 loc) · 1.89 KB
/
shared-bump-semver-tags.yaml
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
59
60
61
62
63
64
name: Bump SemVer Tags
on:
workflow_call:
inputs:
include-v-prefix:
description: "Include V prefix on published version"
default: true
required: false
type: boolean
secrets:
PUBLISH_PAT:
description: "Personal Access Token for publishing packages"
required: true
jobs:
bump-tag-version:
name: Bump and tag version
runs-on: ubuntu-latest
permissions:
contents: write
issues: read
pull-requests: read
outputs:
version: ${{ steps.bump.outputs.version }}
steps:
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Validate PR metadata
uses: jefflinse/pr-semver-bump@v1.6.0
id: bump
with:
mode: bump
repo-token: ${{ secrets.PUBLISH_PAT }}
minor-label: minor
major-label: major
patch-label: patch
with-v: ${{ inputs.include-v-prefix }}
update-major-version:
name: Update major version
needs:
- bump-tag-version
runs-on: ubuntu-latest
if: needs.bump-tag-version.outputs.version != ''
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Parse major version
id: parse
run: |
VERSION=${{ needs.bump-tag-version.outputs.version }}
VERSION="${VERSION#[vV]}"
MAJOR_VERSION="${VERSION%%\.*}"
echo ::set-output name=major-version::${MAJOR_VERSION}
- name: Republish major version
run: |
git config user.name "$GITHUB_ACTOR"
git config user.email "$GITHUB_ACTOR@users.noreply.github.com"
git tag -fa v${{ steps.parse.outputs.major-version }} -m "Update v${{ steps.parse.outputs.major-version }} tag"
git push origin v${{ steps.parse.outputs.major-version }} --force
env:
GITHUB_TOKEN: ${{ secrets.PUBLISH_PAT }}