-
Notifications
You must be signed in to change notification settings - Fork 4
71 lines (61 loc) · 1.88 KB
/
Copy pathrelease.yml
File metadata and controls
71 lines (61 loc) · 1.88 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
64
65
66
67
68
69
70
71
name: Release New Version
on:
workflow_dispatch:
inputs:
version:
description: |
The release version in <Major>.<minor> format.
required: true
type: string
dry-run:
description: Do not push anything
default: true
type: boolean
concurrency:
group: release-${{ inputs.version }}
cancel-in-progress: false
jobs:
release:
runs-on: ubuntu-24.04
env:
VERSION: ${{ inputs.version }}
steps:
- uses: actions/checkout@v6
with:
submodules: true
fetch-depth: 0
token: ${{ secrets.RHACS_BOT_GITHUB_TOKEN }}
- uses: ./.github/actions/validate-version
name: Validate version
with:
version: ${{ inputs.version }}
- name: Determine patch version
id: patch
run: |
git checkout release-"${VERSION}"
last_tag="$(git describe --tags --abbrev=0)"
if [[ "$last_tag" =~ ^"${VERSION}"\.x$ ]]; then
patch=0
elif [[ "$last_tag" =~ ^"${VERSION}"\.([[:digit:]]+)$ ]]; then
patch=$((BASH_REMATCH[1] + 1))
else
echo >&2 "Failed to determine patch version for ${VERSION}"
echo >&2 "Last tag found: $last_tag"
exit 1
fi
echo "patch=$patch" >> "$GITHUB_OUTPUT"
- name: Initialize mandatory git config
run: |
git config user.name '${{ github.event.sender.login }}'
git config user.email noreply@github.com
- name: Create release tag
env:
PATCH: ${{ steps.patch.outputs.patch }}
run: |
git tag -a -m "fact v${VERSION}.${PATCH} release" "${VERSION}.${PATCH}"
- name: Push tag
if: ${{ ! inputs.dry-run }}
env:
PATCH: ${{ steps.patch.outputs.patch }}
run: |
git push origin "${VERSION}.${PATCH}"