-
Notifications
You must be signed in to change notification settings - Fork 3
79 lines (62 loc) · 2.34 KB
/
versioning-release.yaml
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
79
name: 📦 Create Release
on:
workflow_dispatch:
jobs:
create-release:
name: 🆕 Create Release
runs-on: ubuntu-latest
steps:
- name: 🌍 Set environment
id: set-environment
run: |
if [[ "${{ github.ref_name }}" == "release-candidate/"* ]]; then
echo "ENVIRONMENT=Release" >> $GITHUB_ENV
else
echo "Release needs to be created from release-candidate branches"
exit 1
fi
- uses: actions/checkout@v4
with:
fetch-depth: "0"
- name: ❔ Extract project version
shell: bash
run: |
VERSION=$( echo ${{ github.ref_name }} | sed -e "s/release.*\///g")
echo "VERSION=$VERSION" >> $GITHUB_ENV
- name: 🪣 Init Git
shell: bash
run: |
git config --global user.email "[email protected]"
git config --global user.name "svc"
- name: ⚙️ Set release branch parameters
id: get-release-branch
run: |
echo "BRANCH_RELEASE=release/${{ env.VERSION }}" >> $GITHUB_ENV
echo "RELEASE_CANDIDATE_SHA=$(git rev-parse ${{ github.ref_name }})" >> $GITHUB_ENV
- name: 🆕 Create Branch release
uses: peterjgrainger/[email protected]
env:
GITHUB_TOKEN: ${{ secrets.PAT_GITHUB_TOKEN }}
with:
branch: ${{ env.BRANCH_RELEASE }}
sha: "${{ env.RELEASE_CANDIDATE_SHA }}"
- uses: actions/checkout@v4
with:
token: ${{ secrets.PAT_GITHUB_TOKEN }}
ref: ${{ env.BRANCH_RELEASE }}
clean: true
fetch-depth: "0"
- name: ⌛ Wait for build to be triggered
shell: bash
run: sleep 30
- name: ⌛ Wait for build to complete
uses: ./.github/actions/utils/wait-job
with:
BRANCH: ${{ env.BRANCH_RELEASE }}
GITHUB_TOKEN: ${{ secrets.PAT_GITHUB_TOKEN }}
- name: 🗑️ Delete Release Candidate branch
continue-on-error: true
uses: dawidd6/[email protected]
with:
github_token: ${{ secrets.PAT_GITHUB_TOKEN }}
branches: "release-candidate/${{ env.VERSION }}"