-
Notifications
You must be signed in to change notification settings - Fork 119
48 lines (44 loc) · 1.53 KB
/
automated_release.rc_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
name: "Automated Release: Release next RC from release branch"
on:
push:
branches:
- '[0-9]+.[0-9]+.[0-9]+'
run-name: Release next RC from '${{ github.ref_name }}'
jobs:
get_tag_name:
name: Calculate next RC number
env:
CURRENT_BRANCH: ${{ github.ref_name }}
runs-on: ubuntu-latest
outputs:
next_version: ${{ steps.calculate-next-version.outputs.next_version }}
steps:
- name: Get latest RC tag.
id: latest_rc_tag
uses: oprypin/find-latest-tag@v1
with:
repository: ${{ github.repository }}
prefix: v${{ env.CURRENT_BRANCH }}rc
- name: Calculate next_version
id: calculate-next-version
run: |
CURRENT_BRANCH="${{ github.ref_name }}"
LATEST_TAG="${{ steps.latest_rc_tag.outputs.tag }}"
LATEST_TAG="${LATEST_TAG#v}"
# Split version by 'rc' and increment the last number
base="${LATEST_TAG%rc*}"
rc_number="${LATEST_TAG##*rc}"
next_rc_number=$((rc_number + 1))
next_version="${base}rc${next_rc_number}"
echo "next_version=$next_version" >> $GITHUB_OUTPUT
tag_and_release:
name: Tag and release version ${{ needs.get_tag_name.outputs.next_version }} from branch ${{ github.ref_name }}
uses: ./.github/workflows/tag.yml
secrets: inherit
permissions:
checks: read
contents: write
needs: get_tag_name
with:
version: ${{ needs.get_tag_name.outputs.next_version }}
from_branch: ${{ github.ref_name }}