-
Notifications
You must be signed in to change notification settings - Fork 3
75 lines (63 loc) · 2.28 KB
/
versioning-release-candidate.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
name: 🆕 Create Release Candidate
on:
push:
branches:
- main
workflow_dispatch:
jobs:
create-release-candidate:
name: 🆕 Create Release Candidate
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- uses: actions/checkout@v4
with:
clean: false
fetch-depth: "0"
- name: ❔ Extract project version
uses: ./.github/actions/versioning/extract-version
- name: Set release candidate branch name
run: |
echo "BRANCH_RELEASE_CANDIDATE=release-candidate/${{ env.VERSION }}" >> $GITHUB_ENV
echo "MAIN_SHA=$(git rev-parse HEAD)" >> $GITHUB_ENV
- name: Delete branch if exists
run: |
if [[ `git show-ref "${{ env.BRANCH_RELEASE_CANDIDATE }}" 2>/dev/null` ]]; then
echo "[INFO] Branch ${{ env.BRANCH_RELEASE_CANDIDATE }} exists, deleting it"
echo "NEEDS_DELETE=true" >> $GITHUB_ENV
else
echo "[INFO] Branch ${{ env.BRANCH_RELEASE_CANDIDATE }} does not exist"
echo "NEEDS_DELETE=false" >> $GITHUB_ENV
fi
- name: 🗑️ Delete Release Candidate branch
if: ${{ env.NEEDS_DELETE == 'true' }}
uses: dawidd6/[email protected]
with:
github_token: ${{ secrets.PAT_GITHUB_TOKEN }}
branches: ${{ env.BRANCH_RELEASE_CANDIDATE }}
- name: ⌛ Wait for deleting branch
if: ${{ env.NEEDS_DELETE == 'true' }}
shell: bash
run: sleep 10
- name: Create Branch release candidate from main
uses: peterjgrainger/[email protected]
env:
GITHUB_TOKEN: ${{ secrets.PAT_GITHUB_TOKEN }}
with:
branch: ${{ env.BRANCH_RELEASE_CANDIDATE }}
sha: "${{ env.MAIN_SHA }}"
- uses: actions/checkout@v4
with:
ref: ${{ env.BRANCH_RELEASE_CANDIDATE }}
token: ${{ secrets.PAT_GITHUB_TOKEN }}
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_CANDIDATE }}
GITHUB_TOKEN: ${{ secrets.PAT_GITHUB_TOKEN}}