-
Notifications
You must be signed in to change notification settings - Fork 5
91 lines (79 loc) · 2.73 KB
/
release-geopackages.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
name: Upload GeoPackages as release assets
# This GitHub Actions workflow checkouts the 7-Zip-compressed GeoPackage
# files generated by @wkhchow, and upload them as release assets on GitHub
# for a tagged release. (Handles a handful of Git LFS.)
on:
push:
branches:
- '**'
tags:
- 'v*'
workflow_dispatch:
inputs:
release_tag:
description: "Release tag"
required: true
concurrency: prevent-race-condition
jobs:
upload-geopackages:
runs-on: ubuntu-latest
if: startsWith(github.ref, 'refs/tags/') || github.event_name == 'workflow_dispatch'
env:
BRANCH_NAME: ${{ github.head_ref || github.ref_name }}
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Check if we are on the correct branch
run: |
set -x
echo "BRANCH_NAME=$BRANCH_NAME"
git branch
ls -l
du -csh .git/lfs
# See https://github.com/actions/checkout/issues/165
- name: Cache Git LFS for GeoPackages
uses: actions/cache@v3
with:
path: .git/lfs
key: ${{ runner.os }}-lfs-gpkg-7z-${{ hashFiles('**/*.7z') }}
- name: Git LFS pull
run: |
set -x
GIT_TRACE=1 git lfs pull -I "**/*.7z"
- name: Show directory after Git LFS pull
run: |
set -x
ls -l
du -csh .git/lfs
# The GeoPackage files inside hexgrid_3857/ and hexgrid_4326/ have identical names,
# but GitHub release assets do not have subdirectories,
# so this step append the EPSG number to the end of the file name
# to prevent filename collision.
- name: Copy and rename GeoPackage files in preparation for upload
run: |
set -x
mkdir release
cp -alv ./*.7z release/
for epsg in 3857 4326; do
pushd "hexgrid_$epsg" || exit 1
for file in *.7z; do
cp -alv "$file" ../release/"$(basename "$file" .7z)_$epsg.7z"
done
popd || exit 1
done
- name: Calculate checksum of GeoPackage files
run: |
set -x
cd release
sha256sum -b *.7z > opendrr-boundaries-gpkg-7z.sha256sum
cat opendrr-boundaries-gpkg-7z.sha256sum
ls -l
- name: "Upload GeoPackage files as release assets using xresloader/upload-to-github-release@v1"
uses: xresloader/upload-to-github-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
file: "release/*.7z;release/opendrr-boundaries-gpkg-7z.sha256sum"
tag_name: ${{ github.event_name == 'workflow_dispatch' && github.event.inputs.release_tag || '' }}
tags: true
draft: false