-
Notifications
You must be signed in to change notification settings - Fork 0
68 lines (58 loc) · 2.8 KB
/
patch-cut.yml
File metadata and controls
68 lines (58 loc) · 2.8 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
## This Action creates a new 'patch-*' branch with the next semantic version number
## - Manually run by developer wiht input of branch to patch off of
## - must be created off of `main` or `release-*` branch
## - creates a PR against the branch it was cut off of
name: "Patch-Cut"
# Workflow runs when manually triggered using the UI or API
on: workflow_dispatch
jobs:
cut-patch:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6.0.2
with:
## This is a Personal Access Token from Admin User that allows us to bypass branch protections on develop
token: ${{ secrets.PAT }}
fetch-depth: 0
- name: "Error if not in main or release branch"
id: branch
run: |
./scripts/release/patch-cut-check.sh ${GITHUB_REF##*/};
echo "##[set-output name=release;]${GITHUB_REF##*/}";
- name: "Get Version Info"
id: version
run: |
git fetch --all --tags;
cd scripts/release;
unzip git-mkver-linux.zip;
cd ../..;
echo "##[set-output name=major;]$(./scripts/release/git-mkver-linux next --format '{Major}')";
echo "##[set-output name=minor;]$(./scripts/release/git-mkver-linux next --format '{Minor}')";
echo "##[set-output name=patch;]$(./scripts/release/git-mkver-linux next --format '{Patch}')";
- name: "Generate Next Version Number"
id: next_version
run: |
echo "##[set-output name=patch;]$(($PATCH_VERSION+1))"
env:
PATCH_VERSION: ${{ steps.version.outputs.patch }}
- name: "Create Patch Branch"
run: |
git config --global user.name 'Release Cut';
git config --global user.email 'release@cut.com';
git checkout -b $PATCH_BRANCH;
./scripts/release/update-versions.sh $PATCH_VERSION;
git commit -a -m "update version for $PATCH_BRANCH";
git push --set-upstream origin $PATCH_BRANCH;
env:
PATCH_BRANCH: patch-${{ steps.version.outputs.major }}.${{ steps.version.outputs.minor }}.${{ steps.next_version.outputs.patch }}
PATCH_VERSION: ${{ steps.version.outputs.major }}.${{ steps.version.outputs.minor }}.${{ steps.next_version.outputs.patch }}
# Note: see https://github.com/repo-sync/pull-request#advanced-options for all options
- name: Create Patch Pull Request
uses: repo-sync/pull-request@v2.12
with:
github_token: ${{ secrets.PAT }}
source_branch: patch-${{ steps.version.outputs.major }}.${{ steps.version.outputs.minor }}.${{ steps.next_version.outputs.patch }}
destination_branch: ${{ steps.branch.outputs.release }}
pr_title: patch-${{ steps.version.outputs.major }}.${{ steps.version.outputs.minor }}.${{ steps.next_version.outputs.patch }}
pr_body: ${{ steps.version.outputs.changelog }}
pr_label: "- release -"