-
Notifications
You must be signed in to change notification settings - Fork 0
77 lines (72 loc) · 2.56 KB
/
ci.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
name: CI
on:
push:
branches:
- main
- v*
pull_request:
branches:
- main
- v*
jobs:
build:
strategy:
matrix:
version:
- tileserver: "v3.1.1"
mbtiles: "0-18_20210325T212157Z"
- tileserver: "v3.1.1"
mbtiles: "0-18_20220815T202133Z"
- tileserver: "v3.1.1"
mbtiles: "0-18_20240612T202043Z"
runs-on: ubuntu-latest
env:
IMAGE_NAME: sg-tileserver-gl
SELF_VERSION: "v1.1.0"
TILESERVER_GL_VERSION: "${{ matrix.version.tileserver }}"
MBTILES_TAG: "${{ matrix.version.mbtiles }}"
steps:
- name: Set TAG_NAME as env var export
run: |-
SUFFIX_TAG="tileserver-${TILESERVER_GL_VERSION}_mbtiles-${MBTILES_TAG}"
echo "TAG_NAME=${SELF_VERSION}_${SUFFIX_TAG}" >> $GITHUB_ENV
echo "OPENRESTY_SUFFIX=_openresty" >> $GITHUB_ENV
SELF_X_VERSION="$(echo ${SELF_VERSION} | cut -d . -f 1)"
echo "X_TAG_NAME=${SELF_X_VERSION}_${SUFFIX_TAG}" >> $GITHUB_ENV
SELF_XY_VERSION="$(echo ${SELF_VERSION} | cut -d . -f 1,2)"
echo "XY_TAG_NAME=${SELF_XY_VERSION}_${SUFFIX_TAG}" >> $GITHUB_ENV
- name: Checkout code
uses: actions/checkout@v2
with:
submodules: true
- uses: actions/setup-node@v3
with:
node-version: 12
- name: Install tera-cli
run: |-
wget https://github.com/guangie88/tera-cli/releases/download/v0.4.0/tera_linux_amd64 -O /tmp/tera
chmod +x /tmp/tera
- name: Check differences between ci.yml and ci.yml.tmpl
run: |-
cp .github/workflows/ci.yml .github/workflows/ci.yml.backup
TERA=/tmp/tera .github-templates/apply-vars.sh
if ! diff .github/workflows/ci.yml .github/workflows/ci.yml.backup; then echo "ci.yml.tmpl and ci.yml differs!" && exit 1; fi
- name: Run setup-scripts
run: |-
MBTILES_TAG=${MBTILES_TAG} ./setup.sh
- name: Build Docker image (native)
run: |-
docker build . -t "${IMAGE_NAME}:${TAG_NAME}" \
--target native \
--build-arg TILESERVER_GL_VERSION="${TILESERVER_GL_VERSION}"
- name: Build Docker image (with openresty)
run: |-
docker build . -t "${IMAGE_NAME}:${TAG_NAME}${OPENRESTY_SUFFIX}" \
--build-arg TILESERVER_GL_VERSION="${TILESERVER_GL_VERSION}"
- name: Push Docker image
run: bash push-images.sh
env:
DOCKER_USERNAME: ${{ secrets.DOCKER_USERNAME }}
DOCKER_PASSWORD: ${{ secrets.DOCKER_PASSWORD }}
IMAGE_ORG: ${{ secrets.IMAGE_ORG }}
if: github.event_name == 'push'