-
Notifications
You must be signed in to change notification settings - Fork 0
101 lines (87 loc) · 3.06 KB
/
check-for-updates.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
name: Check for data source updates
on:
workflow_dispatch:
schedule:
- cron: "0 13 * * *"
jobs:
check-for-updates:
name: Check for updates
runs-on: ubuntu-latest
container: ghcr.io/osgeo/gdal:ubuntu-full-3.9.1
concurrency: check-for-data-source-updates
timeout-minutes: 30
permissions:
contents: read
outputs:
diff: ${{ steps.comparison.outputs.diff }}
steps:
- name: Install csvkit
run: apt-get update && apt-get install -y csvkit
- name: Checkout repository
uses: actions/checkout@v4
- name: Create GeoPackage
run: chmod +x create-geopackage.sh && ./create-geopackage.sh
- name: Upload data-source-checksums.txt artifact
uses: actions/upload-artifact@v4
with:
name: data-source-checksums.txt
path: data-sources/data-source-checksums.txt
if-no-files-found: error
- name: Upload GeoPackage artifact
uses: actions/upload-artifact@v4
with:
name: boundaries-4326.gpkg
path: boundaries-4326.gpkg
if-no-files-found: error
- name: Download latest data source hashes
run: wget -O published-data-source-checksums.txt "https://github.com/govlt/national-boundaries/releases/latest/download/data-source-checksums.txt"
- name: Upload published-data-source-checksums.txt artifact
uses: actions/upload-artifact@v4
with:
name: published-data-source-checksums.txt
path: published-data-source-checksums.txt
if-no-files-found: error
- name: Check that the files are the exact same
id: comparison
run: |
{
echo 'diff<<EOF'
(diff -u 'published-data-source-checksums.txt' 'data-sources/data-source-checksums.txt' || :)
echo 'EOF'
} >> "${GITHUB_OUTPUT}"
create-release:
name: Create release
if: ${{ needs.check-for-updates.outputs.diff != '' }}
runs-on: ubuntu-latest
concurrency: check-for-data-source-updates-create-release
needs:
- check-for-updates
permissions:
contents: read
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Get Token for creating new Release
id: get_workflow_token
uses: peter-murray/workflow-application-token-action@v3
with:
application_id: ${{ secrets.APPLICATION_ID }}
application_private_key: ${{ secrets.APPLICATION_PRIVATE_KEY }}
permissions: "contents:write"
revoke_token: true
- name: Get next version
uses: reecetech/[email protected]
id: version
with:
scheme: calver
- name: Release
uses: softprops/action-gh-release@v2
with:
make_latest: false
tag_name: ${{ steps.version.outputs.version }}
token: ${{ steps.get_workflow_token.outputs.token }}
body: |
Automated release after data source update
```
${{ needs.check-for-updates.outputs.diff }}
```