-
Notifications
You must be signed in to change notification settings - Fork 11
184 lines (178 loc) · 7.31 KB
/
release-perform.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
name: Release Perform
run-name: Release Perform v${{ github.event.inputs.releaseVersion }}
on:
workflow_dispatch:
inputs:
deploy:
type: boolean
required: true
default: true
releaseVersion:
type: string
required: true
jobs:
build-native:
strategy:
fail-fast: false
matrix:
config:
- host: ubuntu-latest
target: i686-unknown-linux-gnu
artifact: linux-x86_32
linker: gcc-multilib
pkgFlags: "--define 'skipTests'"
- host: ubuntu-latest
target: x86_64-unknown-linux-gnu
artifact: linux-x86_64
container: quay.io/pypa/manylinux_2_28_x86_64
- host: ubuntu-latest
target: aarch64-unknown-linux-gnu
artifact: linux-aarch_64
linker: gcc-aarch64-linux-gnu
pkgFlags: "--define 'skipTests'"
- host: ubuntu-latest
target: armv7-linux-androideabi
artifact: linux-android-armv7
linker: gcc-arm-linux-gnueabihf
pkgFlags: "--define 'skipTests'"
- host: ubuntu-latest
target: aarch64-linux-android
artifact: linux-android-aarch_64
linker: gcc-aarch64-linux-gnu
pkgFlags: "--define 'skipTests'"
- host: windows-latest
target: i686-pc-windows-msvc
artifact: windows-x86_32
pkgFlags: "--define 'skipTests'"
- host: windows-latest
target: x86_64-pc-windows-msvc
artifact: windows-x86_64
- host: macos-13
target: x86_64-apple-darwin
artifact: osx-x86_64
- host: macos-latest
target: aarch64-apple-darwin
artifact: osx-aarch_64
runs-on: ${{ matrix.config.host }}
container: ${{ matrix.config.container }}
steps:
- uses: actions/checkout@v3
with:
ref: v${{ github.event.inputs.releaseVersion }}
- uses: dtolnay/rust-toolchain@master
with:
toolchain: stable
targets: ${{ matrix.config.target }}
- uses: ./.github/workflows/rust-cache
- name: Install Linker
if: matrix.config.linker
run: |
sudo apt update
sudo apt install ${{ matrix.config.linker }}
- name: Prepare aarch64 Linker
if: matrix.config.target == 'aarch64-unknown-linux-gnu'
run: |
echo "CC_aarch64_unknown_linux_gnu=aarch64-linux-gnu-gcc" >> $GITHUB_ENV
echo "AR_aarch64_unknown_linux_gnu=llvm-ar-14" >> $GITHUB_ENV
echo "CARGO_TARGET_AARCH64_UNKNOWN_LINUX_GNU_LINKER=aarch64-linux-gnu-gcc" >> $GITHUB_ENV
- name: Prepare Android Linker
if: contains(matrix.config.target, 'android')
run: |
ndk_root=${ANDROID_NDK}/toolchains/llvm/prebuilt/linux-x86_64/bin/
adjusted_target=$(echo "${{ matrix.config.target }}" | tr '-' '_')
adjusted_target_upper=$(echo "$adjusted_target" | tr '[:lower:]' '[:upper:]')
compiler=""
if [[ "$adjusted_target" == *"aarch64"* ]]; then
compiler="aarch64-linux-android21-clang"
else
compiler="armv7a-linux-androideabi21-clang"
fi
echo "CC_${adjusted_target}=${ndk_root}/${compiler}" >> $GITHUB_ENV
echo "AR_${adjusted_target}=${ndk_root}/llvm-ar" >> $GITHUB_ENV
echo "CARGO_TARGET_${adjusted_target_upper}_LINKER=${ndk_root}/${compiler}" >> $GITHUB_ENV
- name: Setup Java
uses: actions/setup-java@v3
with:
java-version: "11"
distribution: "temurin"
- name: Run mvn package for native
if: ${{ ! matrix.config.container }}
run: mvn --batch-mode --projects ngrok-java-native --also-make package --activate-profiles ci-native --define 'ngrok.native.classifier=${{ matrix.config.artifact }}' --define 'ngrok.native.target=${{ matrix.config.target }}' ${{ matrix.config.pkgFlags }}
env:
NGROK_AUTHTOKEN: ${{ secrets.NGROK_AUTHTOKEN }}
- name: Install maven (with container)
if: matrix.config.container
run: |
curl -sL https://dlcdn.apache.org/maven/maven-3/3.8.8/binaries/apache-maven-3.8.8-bin.tar.gz -o maven.tar.gz
echo "332088670d14fa9ff346e6858ca0acca304666596fec86eea89253bd496d3c90deae2be5091be199f48e09d46cec817c6419d5161fb4ee37871503f472765d00 maven.tar.gz" | sha512sum -c -
tar xvf maven.tar.gz
rm maven.tar.gz
echo "JAVA_11_HOME=$JAVA_HOME_11_X64" >> $GITHUB_ENV
echo "JAVA_17_HOME=$JAVA_HOME_11_X64" >> $GITHUB_ENV
echo "./apache-maven-3.8.8/bin/" >> $GITHUB_PATH
- name: Run mvn package for native (with container)
if: matrix.config.container
run: mvn --global-toolchains toolchains.xml --batch-mode --projects ngrok-java-native --also-make package --activate-profiles ci-native --define 'ngrok.native.classifier=${{ matrix.config.artifact }}' --define 'ngrok.native.target=${{ matrix.config.target }}' ${{ matrix.config.pkgFlags }}
env:
NGROK_AUTHTOKEN: ${{ secrets.NGROK_AUTHTOKEN }}
- name: Upload Artifacts
uses: actions/upload-artifact@v3
with:
name: ngrok-java-native-${{ github.event.inputs.releaseVersion }}-${{ matrix.config.artifact }}
path: ngrok-java-native/target/ngrok-java-native-${{ github.event.inputs.releaseVersion }}-${{ matrix.config.artifact }}.jar
retention-days: 1
deploy-central:
if: ${{ github.event.inputs.deploy }}
runs-on: ubuntu-latest
needs:
- build-native
steps:
- uses: actions/checkout@v3
with:
ref: v${{ github.event.inputs.releaseVersion }}
- uses: actions/setup-java@v3
with:
java-version: |
17
11
distribution: "temurin"
server-id: ossrh
server-username: MAVEN_USERNAME
server-password: MAVEN_PASSWORD
gpg-private-key: ${{ secrets.OSSRH_GPG_PRIVATE_KEY }}
gpg-passphrase: MAVEN_GPG_PASSPHRASE
- uses: actions/download-artifact@v3
with:
path: ngrok-java-native/target/
- run: mv ngrok-java-native/target/*/* ngrok-java-native/target/
- name: Run mvn deploy
run: mvn --batch-mode deploy --activate-profiles ci-distro,central-distro --fail-at-end
env:
MAVEN_USERNAME: ${{ secrets.OSSRH_USERNAME }}
MAVEN_PASSWORD: ${{ secrets.OSSRH_TOKEN }}
MAVEN_GPG_PASSPHRASE: ${{ secrets.OSSRH_GPG_PASSPHRASE }}
NGROK_AUTHTOKEN: ${{ secrets.NGROK_AUTHTOKEN }}
deploy-github:
if: ${{ github.event.inputs.deploy }}
runs-on: ubuntu-latest
needs:
- build-native
steps:
- uses: actions/checkout@v3
with:
ref: v${{ github.event.inputs.releaseVersion }}
- uses: actions/setup-java@v3
with:
java-version: |
17
11
distribution: "temurin"
- uses: actions/download-artifact@v3
with:
path: ngrok-java-native/target/
- run: mv ngrok-java-native/target/*/* ngrok-java-native/target/
- name: Run mvn deploy
run: mvn --batch-mode deploy --activate-profiles ci-distro,github-distro --fail-at-end
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NGROK_AUTHTOKEN: ${{ secrets.NGROK_AUTHTOKEN }}