Skip to content

Commit 223f6fc

Browse files
committed
ci: improve release workflow (gh release on gh actions), add traces, fix spots coordinates
1 parent c1212e8 commit 223f6fc

9 files changed

Lines changed: 547 additions & 227 deletions

File tree

.github/bikepark-skipped.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,9 @@ A coordinate a few km off is still the single most common cause of an empty resu
2020
## Traces to add to OSM
2121

2222
- [ ] Menton
23+
- [ ] Mont Chauve
24+
- [ ] Sigale
25+
- [ ] Cousimbert
2326
- [ ] Le Mouret
2427
- [ ] 1 in Biel ?
2528

.github/workflows/deploy.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,10 +32,10 @@ jobs:
3232
run: vp check
3333

3434
# The exports are built at release time, not committed, so there is
35-
# nothing to diff. Running the conversion still validates the KML: it
36-
# throws when a spot is missing a required tag axis.
35+
# nothing to diff. Running the export still validates the KML: it throws
36+
# when a spot is missing a required tag axis.
3737
- name: Validate the map data
38-
run: vp run convert
38+
run: vp run export
3939

4040
deploy:
4141
name: ⚡️ Deploy to GitHub Pages

.github/workflows/release.yml

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
name: Release
2+
# `vp run release` bumps the version, tags and pushes from a laptop, which
3+
# needs no credentials. Publishing does, so it happens here instead.
4+
on:
5+
push:
6+
tags: ["v*"]
7+
8+
permissions:
9+
contents: write
10+
11+
jobs:
12+
release:
13+
name: 📦 Publish release
14+
runs-on: ubuntu-latest
15+
steps:
16+
- uses: actions/checkout@v7.0.0
17+
with:
18+
# git-cliff renders the notes from the history, not from the tag alone.
19+
fetch-depth: 0
20+
21+
- uses: voidzero-dev/setup-vp@v1
22+
with:
23+
node-version: "lts"
24+
25+
- name: Install dependencies
26+
run: vp i
27+
28+
# The exports are gitignored, so they are rebuilt here from the tagged
29+
# KML. That also keeps them honest: they cannot drift from the data.
30+
- name: Build the exports
31+
run: vp run export
32+
33+
# The same cliff.toml the local CHANGELOG.md is written with, so the
34+
# release notes and the file always say the same thing. The token lets
35+
# git-cliff read pull request titles and spot first-time contributors.
36+
- name: Write the release notes
37+
env:
38+
GITHUB_TOKEN: ${{ github.token }}
39+
run: vp exec git-cliff --current --strip all --output RELEASE_NOTES.md
40+
41+
- name: Create the release
42+
env:
43+
GH_TOKEN: ${{ github.token }}
44+
run: |
45+
gh release create "${GITHUB_REF_NAME}" \
46+
--title "${GITHUB_REF_NAME}" \
47+
--notes-file RELEASE_NOTES.md \
48+
alpine-mtb-map.kml \
49+
alpine-mtb-map.kmz \
50+
alpine-mtb-map.gpx \
51+
alpine-mtb-map.geojson

.release-it.json

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -10,15 +10,7 @@
1010
"publish": false
1111
},
1212
"github": {
13-
"release": true,
14-
"releaseName": "v${version}",
15-
"releaseNotes": "git-cliff --unreleased --tag v${version} --strip all",
16-
"assets": [
17-
"alpine-mtb-map.kml",
18-
"alpine-mtb-map.kmz",
19-
"alpine-mtb-map.gpx",
20-
"alpine-mtb-map.geojson"
21-
]
13+
"release": false
2214
},
2315
"hooks": {
2416
"after:bump": "git-cliff --tag v${version} --output CHANGELOG.md"

CONTRIBUTING.md

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Contributing
1+
# 🛠️ Contributing
22

33
Contributions are very welcome, especially new spots and price corrections.
44

@@ -8,9 +8,9 @@ Add yours to [`alpine-mtb-map.kml`](alpine-mtb-map.kml) following [Adding a poin
88
vp i && vp dev
99
```
1010

11-
Then open a pull request. The pre-commit hook regenerates the GPX and GeoJSON, so you only ever touch the KML. See [Development](#development) for the rest.
11+
Then open a pull request. The KML is the only data file in the repository - the GPX, GeoJSON and KMZ are generated at release time, so you only ever touch the KML. See [Development](#development) for the rest.
1212

13-
## What is on the map
13+
## 🗺️ What is on the map
1414

1515
Each main pin carries, in its description: what the trails are like, what it costs to get up, its open and closed dates, and an Access table giving the travel time from each origin.
1616

@@ -63,7 +63,7 @@ Seasons that run across New Year work the same way: the four southern-hemisphere
6363

6464
When the shared date is **Any**, weather uses today before 16:00 and tomorrow from 16:00 onward. Weather is enabled by default and can be turned off with the cloud-and-rain button left of the location button. A rain icon appears inside a spot's original coloured dot when at least 1 mm of precipitation or a 50% precipitation probability is forecast for the effective weather date, or at least 5 mm fell the day before. Clicking a spot shows that day, the three days before it and the three days after it. Dates outside Open-Meteo's available range show a clear unavailable message. Forecasts are cached in the browser for six hours to limit Open-Meteo requests.
6565

66-
## Adding a point
66+
## 📍 Adding a point
6767

6868
Everything lives in `alpine-mtb-map.kml`. It is plain XML, so edit it in any text editor - no build step is needed for the data itself. Paste a new `<Placemark>` anywhere between `<Document>` and `</Document>`.
6969

@@ -252,17 +252,17 @@ vp dev
252252
253253
Open the printed URL. If the map is blank, the KML is malformed and the browser console will say where. Then commit the KML - it is the only data file in the repository, and the GPX, GeoJSON and KMZ are generated at release time.
254254
255-
## Other formats
255+
## 🗂️ Other formats
256256
257257
```bash
258-
vp run convert
258+
vp run export
259259
```
260260
261261
Regenerates `alpine-mtb-map.geojson`, `alpine-mtb-map.gpx` and `alpine-mtb-map.kmz` from `alpine-mtb-map.kml`. Points become GPX waypoints and GeoJSON `Point` features, trails become GPX tracks and `LineString` features; HTML descriptions are flattened to plain text for GPX. The `kind` (`bike-park` / `natural` / `no-lift` / `minor` / `trail`) plus every `<ExtendedData>` facet (`spot`, `tags`, `open_from`, `closed_from`, `price_day`, `price_season`) is carried into GeoJSON as a property.
262262
263-
**Never edit the generated files by hand** - the KML is the source of truth and `vp run convert` overwrites them. The three exports are gitignored: [releasing](#releasing) rebuilds them and attaches them to the GitHub release, which is where the download links point.
263+
**Never edit the generated files by hand** - the KML is the source of truth and `vp run export` overwrites them. The three exports are gitignored: [releasing](#releasing) rebuilds them and attaches them to the GitHub release, which is where the download links point.
264264
265-
## Development
265+
## 🔧 Development
266266
267267
The toolchain is [Vite+](https://viteplus.dev/) (`vp`):
268268
@@ -275,30 +275,30 @@ vp dev # local dev server
275275
vp build # static site into dist/
276276
vp preview # serve the built site - use this to test the PWA, not dev
277277
vp check # format + lint (add --fix to apply)
278-
vp run convert # regenerate the GPX, GeoJSON and KMZ exports
278+
vp run export # regenerate the GPX, GeoJSON and KMZ exports
279279
vp run icons # regenerate the PWA icons from public/icon.png
280280
vp run ready # everything CI runs, before you open a pull request
281281
vp run release # cut a release (maintainers)
282282
```
283283
284284
> Everything the tooling needs lives in [`vite.config.js`](vite.config.js).
285285
286-
[`.github/workflows/deploy.yml`](.github/workflows/deploy.yml) runs `vp check` and `vp run convert`, which validates the KML: the conversion refuses a spot that is missing a required tag axis. On `main` it then builds and publishes to GitHub Pages; pull requests get the checks only.
286+
[`.github/workflows/deploy.yml`](.github/workflows/deploy.yml) runs `vp check` and `vp run export`, which validates the KML: the conversion refuses a spot that is missing a required tag axis. On `main` it then builds and publishes to GitHub Pages; pull requests get the checks only.
287287
288-
## Releasing
288+
## 🏷️ Releasing
289289
290-
Maintainers only, and it all happens locally - there is no release workflow.
290+
Maintainers only. Nothing on your machine needs a GitHub token: the local half only writes to git.
291291
292292
```bash
293-
GITHUB_TOKEN=... vp run release
293+
vp run release
294294
```
295295
296-
`release` [depends on](vite.config.js) `convert`, so the exports are always rebuilt from the KML being released before anything is uploaded. Then [release-it](https://github.com/release-it/release-it) prompts for the new version and takes it from there: bump `package.json`, rewrite `CHANGELOG.md`, commit, tag, push, and create the GitHub release with the KML, KMZ, GPX and GeoJSON attached. Add `--dry-run` to see every step without performing any of them, or pass a version to skip the prompt:
296+
[release-it](https://github.com/release-it/release-it) prompts for the new version, then bumps `package.json`, rewrites `CHANGELOG.md` with git-cliff, commits, tags `vX.Y.Z` and pushes. Add `--dry-run` to see every step without performing any of them, or pass a version to skip the prompt:
297297
298298
```bash
299299
vp run release minor --dry-run
300300
```
301301
302-
The token needs `repo` scope. Both tools use it: release-it to create the release, git-cliff to look up pull request titles and authors.
302+
Pushing the tag triggers [`.github/workflows/release.yml`](.github/workflows/release.yml), which does the half that needs credentials, using the workflow's own token: rebuild the exports from the tagged KML with `vp run export`, render the notes, and create the GitHub release with the KML, KMZ, GPX and GeoJSON attached. So the assets can never drift from the data they were tagged with, and the download links keep resolving to the newest release.
303303
304-
The notes come from [git-cliff](https://git-cliff.org/) via [`cliff.toml`](cliff.toml), configured to reproduce GitHub's own format - a flat "What's Changed" list crediting each author, then a "New Contributors" section for anyone whose first pull request this is. That last part is only correct because `cliff.toml` names the GitHub remote; first-time status comes from the API, not from the git history.
304+
The notes come from [git-cliff](https://git-cliff.org/) via [`cliff.toml`](cliff.toml), configured to reproduce GitHub's own format - a flat "What's Changed" list crediting each author, then a "New Contributors" section for anyone whose first pull request this is. That last part is only correct because `cliff.toml` names the GitHub remote: first-time status comes from the API, not from the git history. The same config writes `CHANGELOG.md`, so the file and the release notes always say the same thing.

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
<img src="public/icon.png" width="96" height="96" alt="Alpine MTB Map logo">
33
<h1>Alpine MTB Map</h1>
44
<p>A curated open map for gravity mountain biking. Discover top downhill bike parks, enduro trails, and freeride spots worldwide.</p>
5+
[![Deploy to GitHub Pages](https://github.com/vemonet/alpine-mtb-map/actions/workflows/deploy.yml/badge.svg)](https://github.com/vemonet/alpine-mtb-map/actions/workflows/deploy.yml) [![Release](https://github.com/vemonet/alpine-mtb-map/actions/workflows/release.yml/badge.svg)](https://github.com/vemonet/alpine-mtb-map/actions/workflows/release.yml)
56
</div>
67

78
- **Map:** [vemonet.github.io/alpine-mtb-map](https://vemonet.github.io/alpine-mtb-map)

0 commit comments

Comments
 (0)