-
Notifications
You must be signed in to change notification settings - Fork 13
113 lines (97 loc) · 3.58 KB
/
start-release-train.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
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
name: Start Release Train
run-name: Start Release Train ${{ inputs.version_number }}
on:
workflow_dispatch:
inputs:
version_number:
description: 'Next version number of the release'
type: string
required: true
dry_run:
description: 'If true, the workflow will not create a PR'
type: boolean
required: false
default: false
env:
LC_ALL: en_US.UTF-8
LANG: en_US.UTF-8
NO_FLIPPER: 1
concurrency:
group: start-release-train-${{ inputs.version_number }}
cancel-in-progress: true
jobs:
create_release_pr:
name: Create release branch and bump version
runs-on: macos-14
outputs:
branch_name: ${{ steps.branching.outputs.branch_name }}
steps:
- uses: actions/checkout@v4
- name: Setup Git User
run: |
# setup git
git config --global user.name "Bitmovin Release Automation"
git config --global user.email "[email protected]"
- name: Setup Environment
uses: ./.github/actions/setup-environment
with:
node: true
- name: Restore Pods cache
id: pods-cache-restore
uses: actions/cache/restore@v3
with:
path: |
.cocoapods-cache
example/ios/Pods
key: pods-${{ hashFiles('example/ios/Podfile.lock') }}-${{ hashFiles('integration_test/ios/Podfile.lock') }}
restore-keys: pods-
- name: Set Release Branch name
id: branching
run: |
branch_name="release/v${{ inputs.version_number }}"
echo "branch_name=$branch_name" >> $GITHUB_OUTPUT
echo "$branch_name"
- name: Create Release Branch
if: ${{ !inputs.dry_run }}
run: |
# Delete the release branch if already exists, useful in case we need to re-run this workflow
git push origin --delete ${{ steps.branching.outputs.branch_name }} || true
git checkout -b ${{ steps.branching.outputs.branch_name }}
- name: Bump changelog version
run: |
sed -i'.bak' "s/\[Unreleased\]/\[${{ inputs.version_number }}\]/g" CHANGELOG.md
awk 'BEGIN {count=0} /## \[/ {count++; if (count == 2) exit} {print}' CHANGELOG.md
- name: Bump package.json version
run: |
yarn version --new-version ${{ inputs.version_number }} --no-git-tag-version
- name: Install pods to update Podfile.lock
run: |
yarn bootstrap
env:
CP_HOME_DIR: ${{ github.workspace }}/.cocoapods-cache
NO_FLIPPER: 1
- name: Save Pods cache
if: steps.pods-cache-restore.outputs.cache-hit != 'true'
uses: actions/cache/save@v3
with:
path: |
.cocoapods-cache
example/ios/Pods
integration_test/ios/Pods
key: ${{ steps.pods-cache-restore.outputs.cache-primary-key }}
- name: Commit changelog version bump
if: ${{ !inputs.dry_run }}
run: |
git add CHANGELOG.md package.json example/ios/Podfile.lock integration_test/ios/Podfile.lock
git commit -m "prepare release ${{ inputs.version_number }}"
git push origin ${{ steps.branching.outputs.branch_name }}
- name: Create PR
if: ${{ !inputs.dry_run }}
run: |
gh pr create \
--base "main" \
--title "Release ${{ inputs.version_number }}" \
--body "Release ${{ inputs.version_number }}. Please review and merge this PR to continue the release process." \
--reviewer "${{ github.actor }}"
env:
GH_TOKEN: ${{ github.token }}