-
Notifications
You must be signed in to change notification settings - Fork 1
192 lines (168 loc) · 5.22 KB
/
build-libheif.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
name: Build LibHeif
on:
schedule:
- cron: '0 0 * * 0'
workflow_dispatch:
jobs:
check:
runs-on: ubuntu-latest
outputs:
version: ${{ steps.set_release.outputs.version }}
name: ${{ steps.set_release.outputs.name }}
body: ${{ steps.set_release.outputs.body }}
steps:
- name: Get Libheif Release
id: libheif_release
uses: joutvhu/get-release@v1
with:
owner: strukturag
repo: libheif
latest: true
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Get Current Release
id: latest_release
uses: joutvhu/get-release@v1
with:
pattern: 'v.+_libheif'
latest: true
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Set version by release
id: cut_suffix
run: |
echo "::set-output name=version::$(echo ${{ steps.latest_release.outputs.tag_name }} | cut -f 1 -d _)"
- name: Set version
id: set_release
if: ${{ steps.cut_suffix.outputs.version != steps.libheif_release.outputs.tag_name }}
run: |
echo "::set-output name=version::$(echo ${{ steps.libheif_release.outputs.tag_name }} | cut -c 2-)"
echo "::set-output name=name::${{ steps.libheif_release.outputs.name }}"
echo "::set-output name=body::${{ steps.libheif_release.outputs.body }}"
build:
runs-on: ubuntu-latest
needs: check
env:
EMSCRIPTEN_VERSION: 3.1.61
if: ${{ needs.check.outputs.version != null }}
steps:
- uses: actions/checkout@v3
- name: Download and extract libheif
run: |
chmod +x libheif.sh
./libheif.sh ${{ needs.check.outputs.version }} --extract
- name: Install emscripten
working-directory: libheif
run: |
./scripts/install-ci-linux.sh
- name: Prepare CI
working-directory: libheif
run: |
./scripts/prepare-ci.sh
- name: Run CI
working-directory: libheif
run: |
./scripts/run-ci.sh
- name: Copy file
run: |
mkdir -p dist
rm -rf dist/*
cp libheif/libheif.js dist/libheif.min.js
cp libheif/COPYING dist/LICENSE
ls -a -R
- name: Upload artifact
uses: actions/upload-artifact@v3
with:
name: libheif-js
path: |
dist/libheif.min.js
dist/LICENSE
unminify:
runs-on: ubuntu-latest
needs: build
steps:
- name: Set up Node.js
uses: actions/setup-node@v3
with:
node-version: 16
- name: Install packages
run: npm i -g unminify
- name: Download artifact
uses: actions/download-artifact@v3
with:
name: libheif-js
path: dist
- name: Unminify libheif
run: unminify dist/libheif.min.js | sudo tee dist/libheif.js
- name: Upload artifact
uses: actions/upload-artifact@v3
with:
name: libheif
path: |
dist/libheif.min.js
dist/libheif.js
dist/LICENSE
- uses: joutvhu/delete-artifact@v1
with:
name: libheif-js
release:
runs-on: ubuntu-latest
needs: [check, build]
outputs:
upload_url: ${{ steps.create_release.outputs.upload_url }}
steps:
- name: Create Release
id: create_release
uses: joutvhu/create-release@v1
with:
tag_name: v${{ needs.check.outputs.version }}_libheif
name: Release libheif ${{ needs.check.outputs.name }}
body: |
Create libheif.js for https://github.com/strukturag/libheif/releases/tag/v${{ needs.check.outputs.version }}
${{ needs.check.outputs.body }}
draft: false
release: false
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
upload:
runs-on: ubuntu-latest
needs: [unminify, release]
if: ${{ needs.release.outputs.upload_url != null }}
permissions:
contents: write
packages: write
steps:
- name: Download artifact
uses: actions/download-artifact@v3
with:
name: libheif
- name: Upload libheif file
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ needs.release.outputs.upload_url }}
asset_name: libheif.min.js
asset_path: ./libheif.min.js
asset_content_type: text/javascript
- name: Upload unminify file
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ needs.release.outputs.upload_url }}
asset_name: libheif.js
asset_path: ./libheif.js
asset_content_type: text/javascript
- name: Upload LICENSE file
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ needs.release.outputs.upload_url }}
asset_name: LICENSE
asset_path: ./LICENSE
asset_content_type: text/plain
- uses: joutvhu/delete-artifact@v1
with:
name: libheif