Skip to content

Free games for graphing calculators: NumWorks, TI-Nspire CX, Casio fx-CG50 and soon TI-84 Plus CE. Balatro, Celeste, Hollow Knight, Minecraft and more.

CI: release when main reaches a new version

Mason Chen7490d2ad2494
diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml
index 03848712..19f97710 100644
--- a/.github/workflows/build.yml
+++ b/.github/workflows/build.yml
@@ -1,7 +1,7 @@
name: Build
-# Builds NumPlay.nwa, its discreet versions and every game on its own. Pushing a tag like v1.2.0
-# publishes them as a GitHub release.
+# Builds NumPlay.nwa, its discreet versions and every game on its own, and publishes them as a GitHub
+# release when main reaches a version (VERSION) not released yet. Pushing a tag like v1.2.0 does too.
on:
push:
@@ -58,12 +58,18 @@ jobs:
build/apps/*.nwa
- name: Release
- if: startsWith(github.ref, 'refs/tags/v')
+ if: startsWith(github.ref, 'refs/tags/v') || (github.ref == 'refs/heads/main' && github.event_name != 'pull_request')
env:
GH_TOKEN: ${{ github.token }}
- # GitHub lists the files A to Z: the notes list them in order, and each file gets a label
+ # The tag pushed, or on main v + VERSION (made here if it isn't released yet). GitHub lists the
+ # files A to Z: the notes list them in order, and each file gets a label
run: |
- python3 tools/release.py --tag "$GITHUB_REF_NAME" --notes build/release-notes.md > build/release-files.txt
+ if [[ "$GITHUB_REF" == refs/tags/* ]]; then tag="$GITHUB_REF_NAME"; else tag="v$(tr -d '[:space:]' < VERSION)"; fi
+ if gh release view "$tag" > /dev/null 2>&1; then
+ echo "$tag is already released"
+ exit 0
+ fi
+ python3 tools/release.py --tag "$tag" --notes build/release-notes.md > build/release-files.txt
mapfile -t files < build/release-files.txt
- gh release create "$GITHUB_REF_NAME" "${files[@]}" \
- --title "NumPlay $GITHUB_REF_NAME" --notes-file build/release-notes.md
+ gh release create "$tag" "${files[@]}" --target "$GITHUB_SHA" \
+ --title "NumPlay $tag" --notes-file build/release-notes.md