-
Notifications
You must be signed in to change notification settings - Fork 0
168 lines (143 loc) · 3.92 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
name: Publish
on:
workflow_dispatch:
inputs:
prerelease:
type: boolean
default: false
description: whether the release should be marked as a prerelease
jobs:
swig:
name: Generate the SWIG wrappers
uses:
./.github/workflows/swig.yml
build-native:
name: Build native ${{ matrix.platform && '' || '' }}
needs: swig
strategy:
fail-fast: false
matrix:
include:
- platform: ubuntu-20.04
id: linux-x64
- platform: macos-latest
id: darwin-arm64
- platform: macos-12
id: darwin-x64
- platform: windows-2019
id: windows-x64
uses:
./.github/workflows/build.yml
with:
platform: ${{ matrix.platform }}
native: true
wasm: false
id: ${{ matrix.id }}
enable_tiff: true
build-wasm:
name: Build WASM
needs: swig
uses:
./.github/workflows/build.yml
with:
platform: ubuntu-latest
native: false
wasm: true
enable_tiff: true
inline_projdb: false
id: emscripten-wasm32
create-release:
name: Create the Github release
runs-on: ubuntu-latest
needs: [ build-native, build-wasm ]
permissions:
contents: write
steps:
- uses: actions/checkout@v4
- name: Create Release
uses: ncipollo/release-action@v1
with:
draft: true
prerelease: ${{ inputs.prerelease }}
pack-prebuilt-binaries:
name: Pack the prebuilt binaries
runs-on: ubuntu-latest
needs: [ create-release ]
permissions:
contents: write
strategy:
fail-fast: false
matrix:
platform: [linux-x64, win32-x64, darwin-x64, darwin-arm64, emscripten-wasm32]
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Node.js 20
uses: actions/setup-node@v4
with:
node-version: 20
- name: Download the artifact for ${{ matrix.platform }}
uses: actions/download-artifact@v4
with:
name: ${{ matrix.platform }}
path: lib/binding
- name: Pack
run:
tar -zcvf ${{ matrix.platform }}.tar.gz lib/binding
- name: Publish
uses: ncipollo/release-action@v1
with:
allowUpdates: true
artifacts: ${{ matrix.platform }}.tar.gz
updateOnlyUnreleased: true
omitDraftDuringUpdate: true
omitPrereleaseDuringUpdate: true
create-npm-package:
name: Create the npm package
runs-on: ubuntu-latest
needs: [ build-native, build-wasm ]
permissions:
contents: write
outputs:
version: ${{ steps.version.outputs.version }}
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
submodules: true
- name: Download the SWIG-generated wrappers
uses: actions/download-artifact@v4
with:
name: swig
path: swig
- run: npm pack
- name: Get version
id: version
run: node -p '"version=" + require("./package.json").version' >> "$GITHUB_OUTPUT"
- name: Upload the npm package
uses: ncipollo/release-action@v1
with:
allowUpdates: true
artifacts: proj.js-${{ steps.version.outputs.version }}.tgz
updateOnlyUnreleased: true
omitDraftDuringUpdate: true
omitPrereleaseDuringUpdate: true
publish-release:
name: Publish the Github release
runs-on: ubuntu-latest
needs: [ create-npm-package, pack-prebuilt-binaries ]
steps:
- name: Publish the draft release
uses: ncipollo/release-action@v1
with:
allowUpdates: true
omitDraftDuringUpdate: false
draft: false
omitPrereleaseDuringUpdate: true
test_package:
name: Test the npm package
uses: ./.github/workflows/test-package.yml
needs: [ publish-release, create-npm-package ]
with:
package: proj.js-${{ needs.create-npm-package.outputs.version }}.tgz
download: true