-
Notifications
You must be signed in to change notification settings - Fork 5
208 lines (170 loc) · 6.43 KB
/
publish.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
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
name: Publish Package
on:
push:
workflow_dispatch:
inputs:
beta:
description: Publish a beta version (npmjs)
default: false
required: true
type: boolean
android:
description: Publish an android version (maven)
default: true
required: true
type: boolean
rust:
description: Publish a rust version (crates.io)
default: true
required: true
type: boolean
swift:
description: Publish a swift version (cocoapods)
default: true
required: true
type: boolean
wasm:
description: Publish a wasm version (npmjs)
default: true
required: true
type: boolean
jobs:
# build-wasm:
# environment: npm-publish
# if: ${{ inputs.wasm }}
# runs-on: ubuntu-latest
# steps:
# - name: Checkout repo
# uses: actions/checkout@v4
# - name: Checkout action
# uses: actions/checkout@v4
# with:
# repository: Devolutions/actions
# path: actions
# ref: v2
# token: ${{ secrets.DEVOLUTIONSBOT_WRITE_TOKEN }}
# - name: Setup wasm
# run: |
# curl https://rustwasm.github.io/wasm-pack/installer/init.sh -sSf | sh
# wasm-pack --version
# - name: Build
# run: sh build.sh
# working-directory: wrappers/wasm
# - name: Upload artifact
# uses: actions/upload-artifact@v4
# with:
# name: wasm
# path: dist/bundler
# - name: Setup .npmrc config file
# uses: ./actions/npmrc-setup
# with:
# github_token: ${{ secrets.DEVOLUTIONSBOT_WRITE_TOKEN }}
# - name: Publish
# run: npm publish --tag ${{ inputs.beta && 'beta' || 'latest' }}
# working-directory: dist/bundler
# - run: rm $HOME/.npmrc
# - name: Configure NPM
# run: npm config set "//registry.npmjs.org/:_authToken=${{ secrets.NPM_TOKEN }}"
# - name: Publish
# run: npm publish --tag ${{ inputs.beta && 'beta' || 'latest' }}
# working-directory: dist/bundler
# - name: Update Artifactory Cache
# run: gh workflow run update-artifactory-cache.yml --repo Devolutions/scheduled-tasks --field package_name="slauth"
# env:
# GH_TOKEN: ${{ secrets.DEVOLUTIONSBOT_WRITE_TOKEN }}
# build-android:
# environment: cloudsmith-publish
# if: ${{ inputs.android }}
# runs-on: ubuntu-latest
# steps:
# - name: Checkout repo
# uses: actions/checkout@v4
# - name: Set up JDK 1.8
# uses: actions/setup-java@v4
# with:
# java-version: 8
# distribution: adopt
# - name: Setup Android
# run: |
# wget https://dl.google.com/android/repository/android-ndk-r23b-linux.zip
# unzip android-ndk-r23b-linux.zip
# export ANDROID_NDK_HOME=$GITHUB_WORKSPACE/android-ndk-r23b
# echo "ANDROID_NDK_HOME=$ANDROID_NDK_HOME" >> $GITHUB_ENV
# echo "$ANDROID_NDK_HOME/toolchains/llvm/prebuilt/linux-x86_64/bin" >> $GITHUB_PATH
# echo "$ANDROID_NDK_HOME/toolchains/llvm/prebuilt/linux-x86_64/sysroot/usr/lib/x86_64-linux-android" >> $GITHUB_ENV::LIBRARY_PATH
# echo "$ANDROID_NDK_HOME/toolchains/llvm/prebuilt/linux-x86_64/sysroot/usr/lib/x86_64-linux-android" >> $GITHUB_ENV::LD_LIBRARY_PATH
# rustup target add aarch64-linux-android
# rustup target add x86_64-linux-android
# rustup target add x86_64-unknown-linux-gnu
# - name: Build
# run: sh wrappers/android/build.sh
# - name: Create local.properties
# run: echo "sdk.dir=$ANDROID_HOME" > local.properties
# - name: Allow gradlew to run
# run: chmod +x gradlew
# - name: Package .aar
# run: ./gradlew clean assembleRelease
# env:
# CLOUDSMITH_API_KEY: ${{ secrets.CLOUDSMITH_API_KEY }}
# CLOUDSMITH_USERNAME: bot-devolutions
# - run: ./gradlew publish
# env:
# CLOUDSMITH_API_KEY: ${{ secrets.CLOUDSMITH_API_KEY }}
# CLOUDSMITH_USERNAME: bot-devolutions
# - name: Upload .aar artifact
# uses: actions/upload-artifact@v4
# with:
# name: android
# path: wrappers/android/build/outputs/aar/slauth-release.aar
# build-rust:
# environment: crates-publish
# if: ${{ inputs.rust }}
# runs-on: ubuntu-latest
# steps:
# - uses: actions/checkout@v4
# - name: Publish
# run: cargo publish
# env:
# CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }}
build-swift:
environment: cocoapods-publish
runs-on: macos-latest
steps:
- name: Checkout repo
uses: actions/checkout@v4
- name: Setup rust
run: |
rustup target add aarch64-apple-ios
rustup target add x86_64-apple-ios
cargo install cargo-lipo
- name: Build iOS libraries
run: sh wrappers/swift/build.sh
- name: Setup CocoaPods Trunk Token
run: echo -e "machine trunk.cocoapods.org\n login bot@devolutions.net\n password ${{ secrets.COCOAPODS_TRUNK_TOKEN }}" > ~/.netrc
- run: cat ~/.netrc
- name: Verify CocoaPods Trunk Token
run: |
pod trunk me || echo "Invalid token"
# - name: Setup version
# id: version
# run: |
# VERSION=$(grep -E "^\s*s\.version\s*=\s*['\"][0-9]+\.[0-9]+\.[0-9]+['\"]" Slauth.podspec | awk -F"[\"\']" '{print $2}')
# echo "branch_name=release/cocoapods-v$VERSION" >> $GITHUB_OUTPUT
# - name: Push to a new branch
# run: |
# git checkout --orphan ${{ steps.version.outputs.branch_name }}
# git rm -rf .
# git checkout devops/cloudsmith-cocoapods -- LICENSE wrappers/swift/classes slauth.h Slauth.podspec
# git add LICENSE wrappers/swift/classes/** slauth.h Slauth.podspec target/universal/release/* target/x86_64-apple-ios/release/* target/aarch64-apple-ios/release/*
# git commit -m "Set up CocoaPods release branch"
# git push origin ${{ steps.version.outputs.branch_name }}
# env:
# GITHUB_TOKEN: ${{ github.token }}
# - name: Update Podspec
# run: sed -i '' "s|:branch => '.*'|:branch => '${{ steps.version.outputs.branch_name }}'|" Slauth.podspec
- name: Validate podspec
run: pod spec lint --skip-import-validation --use-libraries --allow-warnings
- name: Publish to CocoaPods
run: pod trunk push Slauth.podspec --skip-import-validation --use-libraries --allow-warnings
env:
COCOAPODS_TRUNK_TOKEN: ${{ secrets.COCOAPODS_TRUNK_TOKEN }}