-
Notifications
You must be signed in to change notification settings - Fork 0
33 lines (31 loc) · 1.06 KB
/
cd.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
name: CD
on:
release:
types:
- prereleased
- released
jobs:
milestone:
if: startsWith(github.ref, 'refs/tags')
uses: ComPWA/actions/.github/workflows/close-milestone.yml@v1
push-to-version-branches:
name: Push to version branches
if: startsWith(github.ref, 'refs/tags') && !github.event.release.prerelease
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v4
- name: Configure Git credentials
run: |
git config --global user.name "GitHub Action"
git config --global user.email "41898282+github-actions[bot]@users.noreply.github.com"
- name: Push to matching minor version branch
env:
TAG: ${{ github.ref_name }}
run: |
re='^(v?)([0-9]+)\.([0-9]+)\.[0-9]+'
if [[ $TAG =~ $re ]]; then
MAJOR_VERSION="${BASH_REMATCH[2]}"
MINOR_VERSION="${BASH_REMATCH[2]}.${BASH_REMATCH[3]}"
git push origin HEAD:refs/heads/v$MAJOR_VERSION --force
git push origin HEAD:refs/heads/v$MINOR_VERSION --force
fi