forked from t-rex-tileserver/t-rex
-
Notifications
You must be signed in to change notification settings - Fork 0
223 lines (197 loc) · 6.42 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
name: Release
on:
push:
tags:
- "v*.*.*"
workflow_dispatch:
jobs:
tgz:
name: Build release tgz
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: ['ubuntu-22.04', 'macOS-latest']
steps:
- uses: actions/checkout@v3
- name: Install toolchain
uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: stable
override: true
- name: Cargo build
run: cargo build --release --no-default-features
- name: Tar
run: |
VERSION=$(basename ${{ github.ref }})
target=$(gcc -dumpmachine)
cd target/release
strip t_rex
tar czf ../../t-rex-$VERSION-$target.tar.gz t_rex
- name: Upload artifact
uses: actions/upload-artifact@v2
with:
name: ${{ github.run_id }}
path: t-rex-*.tar.gz
retention-days: 1
deb:
runs-on: ubuntu-22.04
container: ${{ matrix.container }}
strategy:
matrix:
include:
- variant: jammy
container: null
sudo: sudo
# - variant: focal
# container: null
# sudo: sudo
- variant: bookworm
container: rust:bookworm
sudo: null
- variant: bullseye
container: rust:bullseye
sudo: null
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Install cargo-deb
run: cargo install cargo-deb
- name: Install build-dependencies
run: |
${{ matrix.sudo }} apt update
${{ matrix.sudo }} apt install -y libgdal-dev
- name: Build & package
run: |
cargo deb --variant=${{ matrix.variant }}
dpkg -I target/debian/t-rex*.deb
dpkg -c target/debian/t-rex*.deb
- name: Install package
run: ${{ matrix.sudo }} dpkg -i target/debian/*.deb
- name: Upload artifact
uses: actions/upload-artifact@v2
with:
name: ${{ github.run_id }}
path: target/debian/*.deb
retention-days: 1
rpm:
runs-on: ubuntu-latest
container: ${{ matrix.container }}
strategy:
matrix:
container: ['centos:8']
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Install toolchain
uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: stable
override: true
- name: Install cargo-rpm
run: |
yum install gcc rpm-build -y
cargo install cargo-rpm
- name: Install build-dependencies
run: |
yum install openssl-devel -y
# yum install epel-release -y
# yum install --enablerepo=powertools gdal-devel -y
# RH UBI image registry.access.redhat.com/ubi8/ubi
# rpm -ivh https://dl.fedoraproject.org/pub/epel/epel-release-latest-8.noarch.rpm
# yum install --enablerepo=ubi-8-codeready-builder gdal-devel
- name: Build & package
run: |
ln -s packaging/rpm .rpm
cargo rpm build --output target/rpm/
- name: Upload artifact
uses: actions/upload-artifact@v2
with:
name: ${{ github.run_id }}
path: target/rpm/*.rpm
retention-days: 1
msi:
name: Build MSI
runs-on: windows-2019
steps:
- uses: actions/checkout@v3
- name: Install GDAL
shell: bash
run: |
curl -S -O https://download.gisinternals.com/sdk/downloads/release-1928-x64-dev.zip
7z x release-1928-x64-dev.zip
find release-1928-x64 -ls >release-1928-x64.txt
rm -rf release-1928-x64/bin/ms release-1928-x64/bin/proj release-1928-x64/bin/gdal/{csharp,java,python}
mv release-1928-x64/bin/gdal/apps/* release-1928-x64/bin/
- name: Build
shell: bash
run: |
rustc -Vv
cargo -V
vswhere
export GDAL_HOME=$PWD/release-1928-x64
export GDAL_DATA=$GDAL_HOME/bin/gdal-data
export PATH=$GDAL_HOME/bin:$PATH
ogrinfo --version
ogrinfo --formats
export GDAL_VERSION=$(ogrinfo --version | sed 's/GDAL \(.*\), .*/\1/')
echo $PATH
cargo build --release
target/release/t_rex --version
- name: Create msi
shell: bash
run: |
export VERSION=$(basename ${{ github.ref }})
export RELEASE_DIR=$PWD/target/release
export GDAL_HOME=$PWD/release-1928-x64
cd packaging/windows
"$WIX/bin/heat" dir $GDAL_HOME/bin -var wix.GdalSrcDir -dr BINDIR -nologo -srd -ag -sw5150 -cg gdal -o gdal.wxs
"$WIX/bin/candle" -nologo gdal.wxs
"$WIX/bin/candle" -nologo t-rex.wxs
"$WIX/bin/light" -nologo -dBuildDir=$RELEASE_DIR -dGdalSrcDir=$GDAL_HOME/bin -sice:ICE80 -o t-rex-$VERSION.msi t-rex.wixobj gdal.wixobj
- name: Upload artifact
uses: actions/upload-artifact@v2
with:
name: ${{ github.run_id }}
path: packaging/windows/t-rex-*.msi
retention-days: 1
release:
needs: [tgz, deb, rpm, msi]
runs-on: ubuntu-latest
steps:
- name: Retrieve saved artefacts
uses: actions/download-artifact@v2
with:
name: ${{ github.run_id }}
path: packages
- name: Release
uses: softprops/action-gh-release@v1
with:
body: |
See [CHANGELOG](https://github.com/t-rex-tileserver/t-rex/blob/master/CHANGELOG.md)
files: packages/*
docker-release:
name: Docker release
needs: [release]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Get version tag
id: version
run: |
VERSION=${GITHUB_REF:11}
echo ::set-output name=tag::$VERSION
# refs/tags/v0.14.3-beta1 -> 0.14.3.beta1
echo ::set-output name=deb::${VERSION/-/.}
- name: Build and publish
uses: elgohr/Publish-Docker-Github-Action@v5
env:
DEB_URL: https://github.com/t-rex-tileserver/t-rex/releases/download/v${{ steps.version.outputs.tag }}/t-rex_${{ steps.version.outputs.deb }}-1.focal_amd64.deb
with:
name: sourcepole/t-rex
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
workdir: packaging/docker
buildargs: DEB_URL
tag_names: true