From 5fe35180b75efa1eb8758315001ad1a3b93b1dd1 Mon Sep 17 00:00:00 2001 From: Rafael Vuijk Date: Mon, 28 Sep 2026 19:01:52 +0000 Subject: [PATCH] The Terminal is released with the packages, under their version The self-contained builds and .debs were released to AngouriMathLab when Sources/Terminal/VERSION changed on master, and that file still read 1.0.0.6. They are now released on the event that publishes the packages, `release: published`, under the version Nuget.yml reads from the release's tag, so a 2.6.0 release carries a 2.6.0 Terminal. VERSION is gone, and pack-deb-linux.sh takes the version from the workflow. Run by hand, the workflow packs the version it is given and releases only when asked; a pull request packs 0.0.0. Part of #539. Co-Authored-By: Claude Opus 5.5 --- .github/workflows/EverythingBuild.yml | 7 ++- .github/workflows/TerminalNightly.yml | 49 ++++++++++++++----- .../AngouriMath.Terminal/pack-deb-linux.sh | 4 +- Sources/Terminal/VERSION/VERSION | 1 - 4 files changed, 42 insertions(+), 19 deletions(-) delete mode 100644 Sources/Terminal/VERSION/VERSION diff --git a/.github/workflows/EverythingBuild.yml b/.github/workflows/EverythingBuild.yml index 0214ad169..53dc3312a 100644 --- a/.github/workflows/EverythingBuild.yml +++ b/.github/workflows/EverythingBuild.yml @@ -33,10 +33,9 @@ jobs: run: dotnet build Sources/Wrappers/AngouriMath.Interactive/AngouriMath.Interactive.fsproj # AngouriMath.Terminal is a published package -- Nuget.yml packs and pushes it as a - # dotnet tool -- and no pre-merge job built it. TerminalNightly.yml is the only job - # that does, and it fires on push to master behind a path filter on - # Sources/Terminal/VERSION/**, so a change that breaks the terminal is not seen until - # somebody bumps that file or cuts a release. + # dotnet tool -- and no pre-merge job built it. TerminalNightly.yml is the only other job + # that does, and it fires on a release, so a change that breaks the terminal would not be + # seen until a release was cut. - name: Build Terminal run: dotnet build Sources/Terminal/AngouriMath.Terminal/AngouriMath.Terminal.fsproj diff --git a/.github/workflows/TerminalNightly.yml b/.github/workflows/TerminalNightly.yml index 70186bd43..ef5ec31d7 100644 --- a/.github/workflows/TerminalNightly.yml +++ b/.github/workflows/TerminalNightly.yml @@ -1,16 +1,14 @@ -name: 'Terminal nightly builds' +name: 'Terminal release' # Self-contained builds of the Terminal for seven runtimes, zipped, and .debs for Linux, -# released to AngouriMathLab when Sources/Terminal/VERSION changes on master. Run by hand, it -# builds and packs without releasing unless asked to, and a pull request that touches the -# workflow or its scripts builds and packs the same way. +# released to AngouriMathLab alongside each release of the packages and under the same +# version, read from the release's tag as Nuget.yml reads it. Run by hand, it builds and packs +# without releasing unless asked to, and a pull request that touches the workflow or its +# scripts builds and packs the same way. # https://github.com/asc-community/AngouriMath/issues/539 on: - push: - branches: - - master - paths: - - 'Sources/Terminal/VERSION/**' + release: + types: [published] pull_request: paths: - '.github/workflows/TerminalNightly.yml' @@ -18,6 +16,10 @@ on: - 'Sources/Terminal/AngouriMath.Terminal/pack-deb-linux.sh' workflow_dispatch: inputs: + version: + description: 'The version to pack, and to release under if releasing' + type: string + default: '0.0.0' release: description: 'Release the build to AngouriMathLab' type: boolean @@ -38,7 +40,29 @@ jobs: dotnet-version: '10.x' dotnet-quality: 'preview' + # The release's tag without its 'v', as Nuget.yml reads it, so that the Terminal is released + # under the packages' version; by hand, the version asked for; for a pull request, 0.0.0. + - name: 'Determine version' + id: version + env: + TAG: ${{ github.event.release.tag_name }} + ASKED: ${{ inputs.version }} + run: | + if [ "${{ github.event_name }}" = 'release' ]; then + version="${TAG#v}" + else + version="${ASKED:-0.0.0}" + fi + if [[ ! "$version" =~ ^[0-9]+\.[0-9]+\.[0-9]+(-[0-9A-Za-z-]+(\.[0-9A-Za-z-]+)*)?$ ]]; then + echo "Error: '$version' is not a version such as 2.6.0 or 2.6.0-beta.1" + exit 1 + fi + echo "Version: $version" + echo "version=$version" >> "$GITHUB_OUTPUT" + - name: 'Build terminal' + env: + TERMINAL_VERSION: ${{ steps.version.outputs.version }} run: | cd Sources/Terminal/AngouriMath.Terminal ./publish.sh @@ -65,13 +89,12 @@ jobs: angourimath-terminal-*.deb - name: 'Release' - if: github.event_name == 'push' || (github.event_name == 'workflow_dispatch' && inputs.release) + if: github.event_name == 'release' || (github.event_name == 'workflow_dispatch' && inputs.release) env: GH_TOKEN: ${{ secrets.LAB_ACCESS_TOKEN }} + VERSION: ${{ steps.version.outputs.version }} run: | - name=$(cat ./Sources/Terminal/VERSION/VERSION) - echo "Version: $name" - gh release create v$name \ + gh release create "v$VERSION" \ 'angourimath-terminal-linux-x64.zip' \ 'angourimath-terminal-linux-arm.zip' \ 'angourimath-terminal-linux-arm64.zip' \ diff --git a/Sources/Terminal/AngouriMath.Terminal/pack-deb-linux.sh b/Sources/Terminal/AngouriMath.Terminal/pack-deb-linux.sh index 58646579f..e5f09a638 100755 --- a/Sources/Terminal/AngouriMath.Terminal/pack-deb-linux.sh +++ b/Sources/Terminal/AngouriMath.Terminal/pack-deb-linux.sh @@ -1,4 +1,7 @@ #!/bin/bash +# The .deb's version is the release's: TerminalNightly.yml passes the packages' version, read +# from the release's tag. +version="${TERMINAL_VERSION:?set TERMINAL_VERSION to the version to pack, such as 2.6.0}" cd publish-output for arch in amd64 arm arm64 @@ -14,7 +17,6 @@ do dotnet_arch='linux-arm64' fi - version=$(cat ../../VERSION/VERSION) filename="angourimath-terminal_${version}_${arch}" rm -r $filename diff --git a/Sources/Terminal/VERSION/VERSION b/Sources/Terminal/VERSION/VERSION deleted file mode 100644 index b658d66c4..000000000 --- a/Sources/Terminal/VERSION/VERSION +++ /dev/null @@ -1 +0,0 @@ -1.0.0.6