forked from maptiler/tileserver-gl
-
Notifications
You must be signed in to change notification settings - Fork 3
130 lines (108 loc) · 3.99 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
name: 'Build, Test, Release'
on:
workflow_dispatch:
inputs:
version:
description: Choose a release type
required: true
type: choice
options:
- prerelease
- prepatch
- preminor
- premajor
- patch
- minor
- major
jobs:
release:
name: 'Build, Test, Publish'
runs-on: ubuntu-20.04
steps:
- name: "Check out repository ✨"
uses: "actions/[email protected]"
with:
ref: ${{ github.ref }}
token: ${{ secrets.TSPAT }}
- name: Setup node env 📦
uses: actions/setup-node@v3
with:
node-version-file: 'package.json'
check-latest: true
cache: 'npm'
- name: npm version
run: |
echo "NPM_VERSION=$(npm version ${{ github.event.inputs.version }} --preid pre --no-git-tag-version)" >> $GITHUB_ENV
- name: Push version to git
run: |
git config user.name github-actions
git config user.email [email protected]
git commit -a -m "Update TileServer version to ${{ env.NPM_VERSION }} (${{ github.event.inputs.version }})"
git push
- name: Update apt-get 🚀
run: sudo apt update -qq
- name: Install dependencies (Ubuntu) 🚀
run: >-
sudo apt-get install -qq libcairo2-dev libjpeg8-dev libpango1.0-dev
libgif-dev build-essential g++ xvfb libgles2-mesa-dev libgbm-dev
libxxf86vm-dev
- name: Install node dependencies
run: npm install
- name: Pull test data 📦
run: wget -O test_data.zip https://github.com/acalcutt/tileserver-gl/releases/download/test_data/test_data.zip
- name: Prepare test data 📦
run: unzip -q test_data.zip -d test_data
- name: Run tests 🧪
run: xvfb-run --server-args="-screen 0 1024x768x24" npm test
- name: Remove Test Data
run: rm -R test_data*
- name: Publish to Full Version NPM
run: |
npm config set //registry.npmjs.org/:_authToken ${NPM_TOKEN}
npm publish --access public
env:
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
with:
platforms: 'arm64'
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Login to DockerHub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Build and publish Full Version to Docker Hub
uses: docker/build-push-action@v4
with:
context: .
push: true
tags: wifidb/tileserver-gl:latest, wifidb/tileserver-gl:${{env.NPM_VERSION}}
platforms: linux/arm64,linux/amd64
# experimental: https://github.com/docker/build-push-action/blob/master/docs/advanced/cache.md#cache-backend-api
cache-from: type=gha
cache-to: type=gha,mode=max
- name: Create Tileserver Light Directory
run: node publish.js --no-publish
- name: Install node dependencies
run: npm install
working-directory: ./light
- name: Publish to Light Version NPM
working-directory: ./light
run: |
npm config set //registry.npmjs.org/:_authToken ${NPM_TOKEN}
npm publish --access public
env:
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
- name: Build and publish Light Version to Docker Hub
uses: docker/build-push-action@v4
with:
context: ./light
file: ./light/Dockerfile
push: true
tags: wifidb/tileserver-gl-light:latest, wifidb/tileserver-gl-light:${{env.NPM_VERSION}}
platforms: linux/arm64,linux/amd64
# experimental: https://github.com/docker/build-push-action/blob/master/docs/advanced/cache.md#cache-backend-api
cache-from: type=gha
cache-to: type=gha,mode=max