This repository has been archived by the owner on Jan 25, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 4
265 lines (224 loc) · 8.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
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
name: Handle Release
on:
release:
types: [created]
repository_dispatch:
types: [new-release]
workflow_dispatch:
env:
CARGO_TERM_COLOR: always
jobs:
metadata:
name: Generate Matrix
runs-on: windows-latest
steps:
- uses: actions/checkout@v2
- name: Make matrix
id: generate
run: python .github-deps/generate-matrix.py rust/rust-toolchain.toml
outputs:
matrix: ${{ steps.generate.outputs.matrix }}
build:
name: Build
runs-on: windows-latest
needs: metadata
strategy:
matrix: ${{ fromJson(needs.metadata.outputs.matrix) }}
steps:
- name: Get latest release
id: latest_release
uses: kaliber5/action-get-release@v1
with:
token: ${{ github.token }}
latest: true
- name: Get latest IM release
id: latest_release_im
uses: kaliber5/action-get-release@v1
with:
token: ${{ github.token }}
latest: true
repo: Android-ImageMagick7
- name: Checkout Android ImageMagick
uses: actions/checkout@v2
with:
repository: molotovcherry/Android-ImageMagick7
ref: ${{ steps.latest_release_im.outputs.tag_name }}
- name: Checkout KMagick
if: github.event_name != 'workflow_dispatch'
uses: actions/checkout@v2
with:
path: kmagick-rs
ref: ${{ steps.latest_release.outputs.tag_name }}
- name: Checkout KMagick
if: github.event_name == 'workflow_dispatch'
uses: actions/checkout@v2
with:
path: kmagick-rs
- name: Fetch latest Android shared libs
if: matrix.android
uses: i3h/download-release-asset@v1
with:
tag: latest
owner: molotovcherry
repo: Android-ImageMagick7
file: imagemagick-7-android-shared.zip
path: jniLibs/
token: ${{ secrets.GITHUB_TOKEN }}
- name: Extract archives
if: matrix.android
run: |
Expand-Archive -Path jniLibs/imagemagick-7-android-shared.zip -DestinationPath jniLibs/
- name: Cache ImageMagick Setup
if: matrix.windows
id: cache-imagemagick
uses: actions/cache@v2
with:
path: app
key: imagemagick-${{ steps.latest_release_im.outputs.tag_name }}-${{ matrix.im_arch }}
- name: Download ImageMagick Windows DLL release
if: steps.cache-imagemagick.outputs.cache-hit != 'true' && matrix.windows
uses: carlosperate/download-file-action@v1.0.3
with:
file-url: 'https://imagemagick.org/archive/binaries/ImageMagick-${{ steps.latest_release_im.outputs.tag_name }}-Q16-HDRI-${{ matrix.im_arch }}-dll.exe'
file-name: 'ImageMagick.exe'
- name: Fetch latest Innoextract
if: steps.cache-imagemagick.outputs.cache-hit != 'true' && matrix.windows
uses: i3h/download-release-asset@v1
with:
tag: latest
owner: dscharrer
repo: innoextract
file: /innoextract-.*-windows\.zip/
token: ${{ secrets.GITHUB_TOKEN }}
# running the installer does not work in the runner
- name: Install ImageMagick Windows
if: steps.cache-imagemagick.outputs.cache-hit != 'true' && matrix.windows
run: |
$inno = Resolve-Path -Path innoextract-*-windows.zip
Expand-Archive -Path $inno -DestinationPath inno/
inno/innoextract.exe ImageMagick.exe
- name: Cache LLVM and Clang
id: cache-llvm
uses: actions/cache@v2
with:
path: |
${{ runner.temp }}/llvm
key: llvm-12
- name: Install LLVM and Clang # required for bindgen to work, see https://github.com/rust-lang/rust-bindgen/issues/1797
uses: KyleMayes/install-llvm-action@v1
with:
version: "12.0"
directory: ${{ runner.temp }}/llvm
cached: ${{ steps.cache-llvm.outputs.cache-hit }}
- name: Set LIBCLANG_PATH
run: echo "LIBCLANG_PATH=$((gcm clang).source -replace "clang.exe")" >> $env:GITHUB_ENV
- uses: actions-rs/toolchain@v1
with:
profile: ${{ matrix.profile }}
toolchain: ${{ matrix.toolchain }}
target: ${{ matrix.target }}
default: true
- name: Cache Cargo
uses: Swatinem/rust-cache@v1
with:
key: ${{ matrix.target }}-release
working-directory: kmagick-rs/rust
- name: Get NDK
if: matrix.android
uses: nttld/setup-ndk@v1
with:
ndk-version: r22b
- name: Fix LLVM NDK Paths
if: matrix.android
run: |
$ndkRoot = Resolve-Path -Path "${{ runner.temp }}/*/android-ndk-r22b"
echo "ANDROID_NDK_HOME=$ndkRoot" >> $env:GITHUB_ENV
echo "NDK_HOME=$ndkRoot" >> $env:GITHUB_ENV
echo "$ndkRoot" >> $env:GITHUB_PATH
echo "CLANG_PATH=$ndkRoot\toolchains\llvm\prebuilt\windows-x86_64\bin\clang.exe" >> $env:GITHUB_ENV
echo "$ndkRoot\toolchains\llvm\prebuilt\windows-x86_64\bin\" >> $env:GITHUB_PATH
- name: Build
working-directory: kmagick-rs/rust
run: ./${{ matrix.release.tool }}
- name: Rename artifacts
working-directory: kmagick-rs/rust
run: |
Compress-Archive -Path target/${{ matrix.target }}/release/${{ matrix.output }} -DestinationPath kmagick-${{ matrix.target }}.zip
- name: Update release artifacts
uses: xresloader/upload-to-github-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
file: 'kmagick-rs/rust/*.zip'
release_id: ${{ steps.latest_release.outputs.id }}
overwrite: true
draft: false
tag_name: ${{ steps.latest_release.outputs.tag_name }}
build-kmagick:
name: Build KMagick Jar
runs-on: windows-latest
if: github.event_name != 'repository_dispatch'
steps:
- name: Get latest release
id: latest_release
uses: kaliber5/action-get-release@v1
with:
token: ${{ github.token }}
latest: true
- name: Checkout KMagick
uses: actions/checkout@v2
with:
ref: ${{ steps.latest_release.outputs.tag_name }}
fetch-depth: '0'
- name: Compile Jar
run: |
./gradlew kmagick:jar
./gradlew kmagick:sourcesJar
./gradlew kmagick:dokkaHtml
- name: Update docs
run: |
Remove-Item –path docs –recurse
mkdir docs
Move-Item -Path kmagick/build/dokka/html/* -Destination docs/
# we checked out a tag, we're on a detached branch, so we need to checkout main to commit
git checkout main
- name: Create Pull Request
id: cpr
uses: peter-evans/create-pull-request@v3
with:
token: ${{ secrets.REPO_SCOPED_TOKEN }}
commit-message: Update docs to ${{ steps.latest_release.outputs.tag_name }}
committer: GitHub <noreply@github.com>
author: GitHub <noreply@github.com>
signoff: false
branch: docsupdate
delete-branch: true
add-paths: docs
title: 'Update docs to ${{ steps.latest_release.outputs.tag_name }}'
body: |
Hey there!
I updated the docs for release ${{ steps.latest_release.outputs.tag_name }}
**_[ This was automatically generated by github-actions[bot] ]_**
labels: |
automated pr
draft: false
- name: Enable Pull Request Automerge
uses: peter-evans/enable-pull-request-automerge@v1
with:
token: ${{ secrets.REPO_SCOPED_TOKEN }}
pull-request-number: ${{ steps.cpr.outputs.pull-request-number }}
merge-method: rebase
- name: Rename artifacts
run: |
Move-Item -Path kmagick/build/libs/kmagick-*-sources.jar -Destination ./kmagick-sources.jar
Move-Item -Path kmagick/build/libs/kmagick*.jar -Destination ./kmagick.jar
- name: Update release artifacts
uses: xresloader/upload-to-github-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
file: '*.jar'
release_id: ${{ steps.latest_release.outputs.id }}
overwrite: true
draft: false
tag_name: ${{ steps.latest_release.outputs.tag_name }}