-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
185 lines (177 loc) Β· 5.36 KB
/
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
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
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
name: Release
on:
workflow_dispatch:
inputs:
branch:
description: The branch to release from
required: true
default: master
release-type:
description: The type of release to perform
required: true
default: GA
type: choice
options:
- GA
- RC
- RC2
- RC3
- RC4
- Beta
- Beta2
- Beta3
- Beta4
jobs:
validate:
runs-on: ubuntu-latest
name: Validate input parameters
outputs:
vtag: ${{ steps.vtag.outputs.vtag }}
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 0
ref: ${{ github.event.inputs.branch }}
- name: Create version tag
id: vtag
run: |
PACKAGE_VERSION=$(sed -n 's/^ *"version": *"//p' package.json | tr -d '"' | tr -d ',' | tr -d '[[:space:]]')
VTAG="${PACKAGE_VERSION}.${{ github.event.inputs.release-type }}"
echo "vtag=${VTAG}" >> $GITHUB_ENV
echo "vtag=${VTAG}" >> $GITHUB_OUTPUT
- name: Validate version
uses: actions/github-script@v7
env:
vtag: ${{ env.vtag }}
with:
script: |
const releaseMeta = github.rest.repos.listReleases.endpoint.merge({
owner: context.repo.owner,
repo: context.repo.repo,
});
const releases = await github.paginate(releaseMeta);
for (const release of releases) {
if (release.name === process.env.vtag) {
throw new Error(`${process.env.vtag} already exists`);
}
}
console.log(`${process.env.vtag} does not exist so continuing`)
android:
runs-on: ubuntu-20.04
needs: [validate]
env:
CCACHE_DIR: ${{ github.workspace }}/.ccache
USE_CCACHE: 1
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 0
ref: ${{ github.event.inputs.branch }}
- name: Android build
uses: ./.github/actions/build-android
with:
node-version: '20.x'
java-version: '17'
ios:
runs-on: macos-13
name: iOS
needs: [validate]
env:
CCACHE_DIR: ${{ github.workspace }}/.ccache
USE_CCACHE: 1
DEVELOPER_DIR: /Applications/Xcode_14.3.app/Contents/Developer
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 0
ref: ${{ github.event.inputs.branch }}
- name: iOS build
uses: ./.github/actions/build-ios
with:
node-version: '20.x'
package:
runs-on: macos-12
name: Package
env:
SDK_BUILD_CACHE_DIR: ${{ github.workspace }}/.native-modules
DEVELOPER_DIR: /Applications/Xcode_14.2.app/Contents/Developer
vtag: ${{ needs.validate.outputs.vtag }}
needs: [validate, android, ios]
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 0
ref: ${{ github.event.inputs.branch }}
- name: Package
uses: ./.github/actions/package
with:
node-version: '20.x'
java-version: '17'
vtag: ${{ env.vtag }}
release:
runs-on: ubuntu-latest
name: Release
environment: Release
needs: [validate, package]
env:
vtag: ${{ needs.validate.outputs.vtag }}
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 0
ref: ${{ github.event.inputs.branch }}
- run: echo ${{ env.vtag }}
- name: Download Linux artifact
uses: actions/download-artifact@v4
with:
name: mobilesdk-${{ env.vtag }}-linux
- name: Download MacOS artifact
uses: actions/download-artifact@v4
with:
name: mobilesdk-${{ env.vtag }}-osx
- name: Download Windows artifact
uses: actions/download-artifact@v4
with:
name: mobilesdk-${{ env.vtag }}-win32
- name: Create and push tag
run: |
TAG_VERSION=$( echo ${{ env.vtag }} | tr '.' '_' )
git config user.name "${GITHUB_ACTOR}"
git config user.email "${GITHUB_ACTOR}@users.noreply.github.com"
git tag "${TAG_VERSION}"
git push origin "${TAG_VERSION}"
echo "clean-tag=${TAG_VERSION}" >> $GITHUB_ENV
- name: Upload SDK zips (GA)
uses: softprops/action-gh-release@v2
if: ${{ github.event.inputs.release-type == 'GA' }}
with:
files: mobilesdk-${{ env.vtag }}-*
tag_name: ${{ env.clean-tag }}
name: ${{ env.vtag }}
- name: Upload SDK zips (non-GA)
uses: softprops/action-gh-release@v2
if: ${{ github.event.inputs.release-type != 'GA' }}
with:
files: mobilesdk-${{ env.vtag }}-*
tag_name: ${{ env.clean-tag }}
name: ${{ env.vtag }}
prerelease: true
- name: Bump version
if: ${{ github.event.inputs.release-type == 'GA' }}
run: |
npm version patch --no-git-tag-version
git add package.json
git add package-lock.json
git commit -m "chore(release): bump version"
git push
- name: Regen Builds
uses: peter-evans/repository-dispatch@v3
with:
event-type: regen-builds
repository: tidev/downloads-www
token: ${{ secrets.REGEN_BUILDS_DOCS_GITHUB_TOKEN }}