-
Notifications
You must be signed in to change notification settings - Fork 17
78 lines (66 loc) · 2.65 KB
/
cut-minor-release.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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
name: Cut a new Minor Release Branch
on: workflow_dispatch
jobs:
cutReleaseCandidate:
runs-on: ubuntu-latest
outputs:
branch: ${{ steps.set-branch.outputs.branch }}
steps:
- uses: actions/checkout@v3
with:
ssh-key: ${{ secrets.GH_PAT }}
# Import the GPG key for signing Git commits and tags
- name: Import GPG key
uses: crazy-max/ghaction-import-gpg@v5
with:
gpg_private_key: ${{ secrets.GPG_PRIVATE_KEY }}
passphrase: ${{ secrets.GPG_PASSPHRASE }}
git_user_signingkey: true
git_tag_gpgsign: true
git_commit_gpgsign: true
- name: get Version
run: echo "VERSION=$(cat VERSION)" >> $GITHUB_ENV
- name: Update version environment variable
run: echo "VERSION=$(echo $VERSION | sed 's/pre/rc/g' | awk -F. '{print $1"."$2"."$3"."0}')" >> $GITHUB_ENV
- name: Update 'VERSION' file
run: echo "$VERSION" > VERSION
- name: Update version environment variable e.g. v0.1.0-pre.0 -> v0.1
run: echo "BRANCH=$(echo $VERSION | sed 's/\.[0-9]*-.*//g')" >> $GITHUB_ENV
- name: Store version in branch variable
id: set-branch
run: echo "::set-output name=branch::${{ env.BRANCH }}"
- uses: stefanzweifel/git-auto-commit-action@v4
with:
commit_message: Rev'd 'VERSION' file to ${{ env.VERSION }}
branch: ${{ env.BRANCH }}
create_branch: true
commit_options: -S
commit_user_email: [email protected]
commit_user_name: ci-dominantstrategies
- uses: actions/checkout@v3
with:
ssh-key: ${{ secrets.GH_PAT }}
- name: get Version
run: echo "VERSION=$(cat VERSION)" >> $GITHUB_ENV
- name: Update version environment variable
run: echo "VERSION=$(echo $VERSION | sed "s/-.*//g" | awk -F. '{print $1"."$2+1"."0"-pre.0"}')" >> $GITHUB_ENV
- name: Update 'VERSION' file
run: echo "$VERSION" > VERSION
- uses: stefanzweifel/git-auto-commit-action@v4
with:
commit_message: Rev'd 'VERSION' file to ${{ env.VERSION }}
branch: main
commit_options: -S
commit_user_email: [email protected]
commit_user_name: ci-dominantstrategies
deployReleaseCandidate:
uses: ./.github/workflows/build-deploy.yml
secrets:
DOCKER: ${{ secrets.DOCKER }}
GH_PAT: ${{ secrets.GH_PAT }}
GPG_PRIVATE_KEY: ${{ secrets.GPG_PRIVATE_KEY }}
GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }}
with:
awk : sed -e "s/pre/rc/g" | read a; if [[ "$a" =~ "rc" ]];then echo $a | awk -F . '{print $1"."$2"."$3"."$4+1}';else echo $a; fi
rails: '[[ ! "$VERSION" =~ "pre" ]]'
needs: [cutReleaseCandidate]