-
Notifications
You must be signed in to change notification settings - Fork 0
63 lines (60 loc) · 2.23 KB
/
updateReleaseVersions.yml
File metadata and controls
63 lines (60 loc) · 2.23 KB
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
name: Update Release Versions
on:
workflow_call:
inputs:
version:
description: "The version that was just released (semver compliant)"
required: true
type: string
release_ref:
description: "The ref the release versions should point to"
required: true
type: string
outputs:
major:
description: "The major version"
value: ${{ jobs.update_release_versions.outputs.major }}
minor:
description: "The minor version"
value: ${{ jobs.update_release_versions.outputs.minor }}
patch:
description: "The patch version"
value: ${{ jobs.update_release_versions.outputs.patch }}
major_tag:
description: "The major tag that was created (the version number, e.g. 1)"
value: ${{ jobs.update_release_versions.outputs.major_tag }}
minor_tag:
description: "The minor tag that was created (the version number, e.g. 1.2)"
value: ${{ jobs.update_release_versions.outputs.minor_tag }}
jobs:
update_release_versions:
name: Update Release Versions
runs-on: ubuntu-latest
outputs:
major: ${{ steps.parse.outputs.major }}
minor: ${{ steps.parse.outputs.minor }}
patch: ${{ steps.parse.outputs.patch }}
major_tag: ${{ steps.update.outputs.major }}
minor_tag: ${{ steps.update.outputs.minor }}
steps:
- name: Parse version
id: parse
run: |
echo "major=$(echo ${{ inputs.version }} | cut -d '.' -f 1)" >> $GITHUB_OUTPUT
echo "minor=$(echo ${{ inputs.version }} | cut -d '.' -f 2)" >> $GITHUB_OUTPUT
echo "patch=$(echo ${{ inputs.version }} | cut -d '.' -f 3)" >> $GITHUB_OUTPUT
- name: Checkout
uses: actions/checkout@v6
with:
fetch-depth: 0
- name: Update tags
id: update
run: |
MAJOR="${{ steps.parse.outputs.major }}"
MINOR="${{ steps.parse.outputs.major }}.${{ steps.parse.outputs.minor }}"
TARGET="${{ inputs.release_ref }}"
git tag -f $MAJOR $TARGET
git tag -f $MINOR $TARGET
git push origin $MAJOR $MINOR --force
echo "major=$MAJOR" >> $GITHUB_OUTPUT
echo "minor=$MINOR" >> $GITHUB_OUTPUT