From 29d9650c4cd234f1a3e413ace00003726120cbc7 Mon Sep 17 00:00:00 2001 From: Ranadeep Biswas Date: Thu, 10 Oct 2024 10:51:45 +0200 Subject: [PATCH 01/18] compile and upload quint binaries --- .github/workflows/release.yml | 44 +++++++++++++++++++++++++++++++++++ 1 file changed, 44 insertions(+) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index a2ca42a7b..2c2d47004 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -40,3 +40,47 @@ jobs: run: npm publish env: NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} + deno-compile: + needs: release + runs-on: ubuntu-latest + strategy: + matrix: + config: + [ + { target: "x86_64-unknown-linux-gnu", suffix: "-linux-amd64" }, + { target: "aarch64-apple-darwin", suffix: "-darwin-arm64" }, + { target: "x86_64-pc-windows-msvc", suffix: "-pc-amd64.exe" }, + ] + defaults: + run: + working-directory: ./quint + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Install Deno + uses: denoland/setup-deno@v2 + with: + deno-version: v2.x + + - name: Compile with Deno + run: | + deno compile \ + --target ${{ matrix.config.target }} \ + --output quint-${{ matrix.config.suffix }} \ + --allow-all \ + "npm:@informalsystems/quint@${{ github.ref_name }}" + + - name: Generate SHA256 Hash + run: | + sha256sum quint-${{ matrix.config.suffix }} > quint-${{ matrix.config.suffix }}.sha256 + + - name: Upload Assets to Release + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + run: | + gh release upload "${{ github.ref_name }}" \ + "quint-${{ matrix.config.suffix }}" \ + "quint-${{ matrix.config.suffix }}.sha256" \ + --repo "${{ github.repository }}" \ + --clobber From 2ff4926787a83ca4f52e9617158f39b7432f703b Mon Sep 17 00:00:00 2001 From: Ranadeep Biswas Date: Thu, 10 Oct 2024 10:52:06 +0200 Subject: [PATCH 02/18] use specific release tag name --- .github/workflows/release.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 2c2d47004..43fa23d77 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -35,6 +35,9 @@ jobs: uses: softprops/action-gh-release@v1 with: body_path: ${{ github.workspace }}/release-notes.txt + tag_name: ${{ github.ref_name }} + name: Release ${{ github.ref_name }} + token: ${{ secrets.GITHUB_TOKEN }} - name: Publish # See https://docs.github.com/en/actions/publishing-packages/publishing-nodejs-packages#publishing-packages-to-the-npm-registry run: npm publish From 4e184214c55cab56e1bdbc91a4558dac2a5063c5 Mon Sep 17 00:00:00 2001 From: Ranadeep Biswas Date: Thu, 10 Oct 2024 10:53:01 +0200 Subject: [PATCH 03/18] nits --- .github/workflows/release.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 43fa23d77..35c03b9f7 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -35,6 +35,7 @@ jobs: uses: softprops/action-gh-release@v1 with: body_path: ${{ github.workspace }}/release-notes.txt + # if this is changed, `gh release upload` argument needs to be updated. tag_name: ${{ github.ref_name }} name: Release ${{ github.ref_name }} token: ${{ secrets.GITHUB_TOKEN }} @@ -43,7 +44,7 @@ jobs: run: npm publish env: NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} - deno-compile: + compile: needs: release runs-on: ubuntu-latest strategy: From fe10bddea94ad2fa42d81bf881a27e53046b06c4 Mon Sep 17 00:00:00 2001 From: Ranadeep Biswas Date: Thu, 10 Oct 2024 12:37:49 +0200 Subject: [PATCH 04/18] comment about npm package vs local project --- .github/workflows/release.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 35c03b9f7..1f65c5ebc 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -67,7 +67,8 @@ jobs: with: deno-version: v2.x - - name: Compile with Deno + # Deno can't compile local npm projects. Use the npm release from last step. + - name: Compile with Deno from NPM Release run: | deno compile \ --target ${{ matrix.config.target }} \ From 547d4ab8af23938c37b4f5c806c80eb2acf1033f Mon Sep 17 00:00:00 2001 From: Ranadeep Biswas Date: Thu, 10 Oct 2024 12:38:57 +0200 Subject: [PATCH 05/18] rm leading dash --- .github/workflows/release.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 1f65c5ebc..5d3833141 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -51,9 +51,9 @@ jobs: matrix: config: [ - { target: "x86_64-unknown-linux-gnu", suffix: "-linux-amd64" }, - { target: "aarch64-apple-darwin", suffix: "-darwin-arm64" }, - { target: "x86_64-pc-windows-msvc", suffix: "-pc-amd64.exe" }, + { target: "x86_64-unknown-linux-gnu", suffix: "linux-amd64" }, + { target: "aarch64-apple-darwin", suffix: "darwin-arm64" }, + { target: "x86_64-pc-windows-msvc", suffix: "pc-amd64.exe" }, ] defaults: run: From 2a32ea5cf7412080e0d373b00d3beaa4a694b58f Mon Sep 17 00:00:00 2001 From: Ranadeep Biswas Date: Thu, 10 Oct 2024 12:50:32 +0200 Subject: [PATCH 06/18] quotes for strings --- .github/workflows/release.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 5d3833141..370b4b64d 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -71,14 +71,14 @@ jobs: - name: Compile with Deno from NPM Release run: | deno compile \ - --target ${{ matrix.config.target }} \ - --output quint-${{ matrix.config.suffix }} \ --allow-all \ + --target "${{ matrix.config.target }}" \ + --output "quint-${{ matrix.config.suffix }}" \ "npm:@informalsystems/quint@${{ github.ref_name }}" - name: Generate SHA256 Hash run: | - sha256sum quint-${{ matrix.config.suffix }} > quint-${{ matrix.config.suffix }}.sha256 + sha256sum "quint-${{ matrix.config.suffix }}" > "quint-${{ matrix.config.suffix }}.sha256" - name: Upload Assets to Release env: From 387550665bfce0643a8ac6890ed7d8f68deb7186 Mon Sep 17 00:00:00 2001 From: Rano | Ranadeep Date: Thu, 10 Oct 2024 19:24:17 +0200 Subject: [PATCH 07/18] use GH_TOKEN --- .github/workflows/release.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 370b4b64d..2267f1bd8 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -82,7 +82,8 @@ jobs: - name: Upload Assets to Release env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + # https://docs.github.com/en/actions/writing-workflows/choosing-what-your-workflow-does/using-github-cli-in-workflows + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} run: | gh release upload "${{ github.ref_name }}" \ "quint-${{ matrix.config.suffix }}" \ From c60b419ac6a8b916d2e388ce75f0876a24222224 Mon Sep 17 00:00:00 2001 From: Ranadeep Biswas Date: Sat, 12 Oct 2024 09:44:11 +0200 Subject: [PATCH 08/18] fix release version --- .github/workflows/release.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 2267f1bd8..0e1afc5ea 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -70,11 +70,12 @@ jobs: # Deno can't compile local npm projects. Use the npm release from last step. - name: Compile with Deno from NPM Release run: | + VERSION="$(echo ${{ github.ref_name }} | sed 's/^v//')" deno compile \ --allow-all \ --target "${{ matrix.config.target }}" \ --output "quint-${{ matrix.config.suffix }}" \ - "npm:@informalsystems/quint@${{ github.ref_name }}" + "npm:@informalsystems/quint@${VERSION}" - name: Generate SHA256 Hash run: | From 372bfb0db836288d0e7403f6f880c86b2162e1f1 Mon Sep 17 00:00:00 2001 From: Ranadeep Biswas Date: Sat, 12 Oct 2024 09:50:25 +0200 Subject: [PATCH 09/18] use default ref_name --- .github/workflows/release.yml | 3 --- 1 file changed, 3 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 0e1afc5ea..2b01d55a3 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -35,9 +35,6 @@ jobs: uses: softprops/action-gh-release@v1 with: body_path: ${{ github.workspace }}/release-notes.txt - # if this is changed, `gh release upload` argument needs to be updated. - tag_name: ${{ github.ref_name }} - name: Release ${{ github.ref_name }} token: ${{ secrets.GITHUB_TOKEN }} - name: Publish # See https://docs.github.com/en/actions/publishing-packages/publishing-nodejs-packages#publishing-packages-to-the-npm-registry From 688c30ba8ade1ac96d3703f43a41ff603dcc052a Mon Sep 17 00:00:00 2001 From: Ranadeep Biswas Date: Sat, 12 Oct 2024 11:21:37 +0200 Subject: [PATCH 10/18] nits --- .github/workflows/release.yml | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 2b01d55a3..031d2af14 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -41,7 +41,7 @@ jobs: run: npm publish env: NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} - compile: + binaries: needs: release runs-on: ubuntu-latest strategy: @@ -74,11 +74,15 @@ jobs: --output "quint-${{ matrix.config.suffix }}" \ "npm:@informalsystems/quint@${VERSION}" - - name: Generate SHA256 Hash + - name: Test binary + run: | + ./quint-${{ matrix.config.suffix }} --version + + - name: Generate SHA256 hash run: | sha256sum "quint-${{ matrix.config.suffix }}" > "quint-${{ matrix.config.suffix }}.sha256" - - name: Upload Assets to Release + - name: Upload assets to Release env: # https://docs.github.com/en/actions/writing-workflows/choosing-what-your-workflow-does/using-github-cli-in-workflows GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} From 13ceae46c2f2f18872c653ebb089a5dad6766135 Mon Sep 17 00:00:00 2001 From: Ranadeep Biswas Date: Wed, 16 Oct 2024 14:54:22 +0200 Subject: [PATCH 11/18] upload release binaries via script --- .github/upload-binaries.sh | 77 +++++++++++++++++++++++++++++++++++ .github/workflows/release.yml | 45 ++++---------------- 2 files changed, 85 insertions(+), 37 deletions(-) create mode 100755 .github/upload-binaries.sh diff --git a/.github/upload-binaries.sh b/.github/upload-binaries.sh new file mode 100755 index 000000000..2fadfce1b --- /dev/null +++ b/.github/upload-binaries.sh @@ -0,0 +1,77 @@ +#!/bin/bash + +set -euo pipefail + +usage() { + echo "Usage: $0 [--final] " + exit 1 +} + +DRY_RUN=true +REPO="" +VERSION="" + +while [[ $# -gt 0 ]]; do + case "$1" in + --final) + DRY_RUN=false + shift + ;; + -h|--help) + usage + ;; + *) + if [[ -z "$REPO" ]]; then + REPO="$1" + elif [[ -z "$VERSION" ]]; then + VERSION="$1" + else + usage + fi + shift + ;; + esac +done + +if [[ -z "$REPO" || -z "$VERSION" ]]; then + usage +fi + +VERSION="${VERSION#v}" +RELEASE_TAG="v$VERSION" + +if [ "${GH_TOKEN:-}" = "" ]; then + GH_TOKEN=$(gh auth token) +fi + +TARGETS=( + "x86_64-unknown-linux-gnu:linux-amd64" + "aarch64-apple-darwin:darwin-arm64" + "x86_64-pc-windows-msvc:pc-amd64.exe" +) + +for target_config in "${TARGETS[@]}"; do + IFS=":" read -r TARGET SUFFIX <<< "$target_config" + + echo "Compiling for target: $TARGET" + deno compile \ + --allow-all \ + --target "$TARGET" \ + --output "quint-$SUFFIX" \ + "npm:@informalsystems/quint@$VERSION" + + echo "Generating SHA256 hash for quint-$SUFFIX" + sha256sum "quint-$SUFFIX" > "quint-$SUFFIX.sha256" + + if [ "$DRY_RUN" == true ]; then + echo "[dry run] gh release upload \"$RELEASE_TAG\" \"quint-$SUFFIX\" \"quint-$SUFFIX.sha256\" --repo \"$REPO\" --clobber" + else + gh release upload "$RELEASE_TAG" \ + "quint-$SUFFIX" \ + "quint-$SUFFIX.sha256" \ + --repo "$REPO" \ + --clobber + fi +done + +echo "Release process complete." \ No newline at end of file diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 031d2af14..65afcf379 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -44,51 +44,22 @@ jobs: binaries: needs: release runs-on: ubuntu-latest - strategy: - matrix: - config: - [ - { target: "x86_64-unknown-linux-gnu", suffix: "linux-amd64" }, - { target: "aarch64-apple-darwin", suffix: "darwin-arm64" }, - { target: "x86_64-pc-windows-msvc", suffix: "pc-amd64.exe" }, - ] - defaults: - run: - working-directory: ./quint steps: - - name: Checkout code - uses: actions/checkout@v4 - - name: Install Deno uses: denoland/setup-deno@v2 with: deno-version: v2.x - # Deno can't compile local npm projects. Use the npm release from last step. - - name: Compile with Deno from NPM Release + - name: Wait for NPM + timeout-minutes: 30 run: | - VERSION="$(echo ${{ github.ref_name }} | sed 's/^v//')" - deno compile \ - --allow-all \ - --target "${{ matrix.config.target }}" \ - --output "quint-${{ matrix.config.suffix }}" \ - "npm:@informalsystems/quint@${VERSION}" + REF_NAME=${{ github.ref_name }} + while ! deno run -A "npm:@informalsystems/quint@${REF_NAME#v}" --version; do + sleep 30 + done - - name: Test binary + - name: Upload assets run: | - ./quint-${{ matrix.config.suffix }} --version - - - name: Generate SHA256 hash - run: | - sha256sum "quint-${{ matrix.config.suffix }}" > "quint-${{ matrix.config.suffix }}.sha256" - - - name: Upload assets to Release + ./workflows/upload-binaries.sh ${{ github.repository }} ${{ github.ref_name }} --final env: - # https://docs.github.com/en/actions/writing-workflows/choosing-what-your-workflow-does/using-github-cli-in-workflows GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} - run: | - gh release upload "${{ github.ref_name }}" \ - "quint-${{ matrix.config.suffix }}" \ - "quint-${{ matrix.config.suffix }}.sha256" \ - --repo "${{ github.repository }}" \ - --clobber From 8b2f230af96aac36cea5442f831188dc63f075f1 Mon Sep 17 00:00:00 2001 From: Ranadeep Biswas Date: Wed, 16 Oct 2024 15:02:35 +0200 Subject: [PATCH 12/18] msg for gh auth login --- .github/upload-binaries.sh | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/.github/upload-binaries.sh b/.github/upload-binaries.sh index 2fadfce1b..ebe6358f8 100755 --- a/.github/upload-binaries.sh +++ b/.github/upload-binaries.sh @@ -41,7 +41,11 @@ VERSION="${VERSION#v}" RELEASE_TAG="v$VERSION" if [ "${GH_TOKEN:-}" = "" ]; then - GH_TOKEN=$(gh auth token) + GH_TOKEN=$(gh auth token 2>/dev/null || true) + if [ "$GH_TOKEN" = "" ]; then + echo "GitHub authentication token not found. Run 'gh auth login' to authenticate." + exit 1 + fi fi TARGETS=( From 5c31bac94508cf6d929a33e5e0342d53938d444d Mon Sep 17 00:00:00 2001 From: Ranadeep Biswas Date: Wed, 16 Oct 2024 15:04:43 +0200 Subject: [PATCH 13/18] newline at eof --- .github/upload-binaries.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/upload-binaries.sh b/.github/upload-binaries.sh index ebe6358f8..10b59e096 100755 --- a/.github/upload-binaries.sh +++ b/.github/upload-binaries.sh @@ -78,4 +78,4 @@ for target_config in "${TARGETS[@]}"; do fi done -echo "Release process complete." \ No newline at end of file +echo "Release process complete." From 22aa7c80155e1020c4d33c63873d6bedf6c20b03 Mon Sep 17 00:00:00 2001 From: Ranadeep Biswas Date: Wed, 16 Oct 2024 15:06:41 +0200 Subject: [PATCH 14/18] fix script path --- .github/workflows/release.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 65afcf379..283b510af 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -60,6 +60,6 @@ jobs: - name: Upload assets run: | - ./workflows/upload-binaries.sh ${{ github.repository }} ${{ github.ref_name }} --final + ./.github/upload-binaries.sh ${{ github.repository }} ${{ github.ref_name }} --final env: GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} From d86ac81900140a75d01d25fb266d9ff7b4ffa50b Mon Sep 17 00:00:00 2001 From: Ranadeep Biswas Date: Wed, 16 Oct 2024 15:08:45 +0200 Subject: [PATCH 15/18] ignore GH_TOKEN in dry run --- .github/upload-binaries.sh | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/.github/upload-binaries.sh b/.github/upload-binaries.sh index 10b59e096..148e01a65 100755 --- a/.github/upload-binaries.sh +++ b/.github/upload-binaries.sh @@ -40,11 +40,13 @@ fi VERSION="${VERSION#v}" RELEASE_TAG="v$VERSION" -if [ "${GH_TOKEN:-}" = "" ]; then - GH_TOKEN=$(gh auth token 2>/dev/null || true) - if [ "$GH_TOKEN" = "" ]; then - echo "GitHub authentication token not found. Run 'gh auth login' to authenticate." - exit 1 +if [ "$DRY_RUN" == false ]; then + if [ "${GH_TOKEN:-}" = "" ]; then + GH_TOKEN=$(gh auth token 2>/dev/null || true) + if [ "$GH_TOKEN" = "" ]; then + echo "GitHub authentication token not found. Run 'gh auth login' to authenticate." + exit 1 + fi fi fi From f028f54e30edd5121d012559caf9960b609c6dec Mon Sep 17 00:00:00 2001 From: Ranadeep Biswas Date: Wed, 16 Oct 2024 15:10:30 +0200 Subject: [PATCH 16/18] publish instead of final --- .github/upload-binaries.sh | 4 ++-- .github/workflows/release.yml | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/upload-binaries.sh b/.github/upload-binaries.sh index 148e01a65..80e4529e2 100755 --- a/.github/upload-binaries.sh +++ b/.github/upload-binaries.sh @@ -3,7 +3,7 @@ set -euo pipefail usage() { - echo "Usage: $0 [--final] " + echo "Usage: $0 [--publish] " exit 1 } @@ -13,7 +13,7 @@ VERSION="" while [[ $# -gt 0 ]]; do case "$1" in - --final) + --publish) DRY_RUN=false shift ;; diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 283b510af..cd50ed265 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -60,6 +60,6 @@ jobs: - name: Upload assets run: | - ./.github/upload-binaries.sh ${{ github.repository }} ${{ github.ref_name }} --final + ./.github/upload-binaries.sh ${{ github.repository }} ${{ github.ref_name }} --publish env: GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} From c931076b1d03aadfded45d9e59f415b690f14149 Mon Sep 17 00:00:00 2001 From: Ranadeep Biswas Date: Wed, 16 Oct 2024 15:16:28 +0200 Subject: [PATCH 17/18] macos instead of darwin --- .github/upload-binaries.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/upload-binaries.sh b/.github/upload-binaries.sh index 80e4529e2..59880f80b 100755 --- a/.github/upload-binaries.sh +++ b/.github/upload-binaries.sh @@ -52,7 +52,7 @@ fi TARGETS=( "x86_64-unknown-linux-gnu:linux-amd64" - "aarch64-apple-darwin:darwin-arm64" + "aarch64-apple-darwin:macos-arm64" "x86_64-pc-windows-msvc:pc-amd64.exe" ) From b7bdf8e3e1db891eb608f54d3692c4ca7fed0a87 Mon Sep 17 00:00:00 2001 From: Ranadeep Biswas Date: Wed, 16 Oct 2024 15:37:59 +0200 Subject: [PATCH 18/18] add example in usage --- .github/upload-binaries.sh | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/upload-binaries.sh b/.github/upload-binaries.sh index 59880f80b..25e2d7b7f 100755 --- a/.github/upload-binaries.sh +++ b/.github/upload-binaries.sh @@ -4,6 +4,9 @@ set -euo pipefail usage() { echo "Usage: $0 [--publish] " + echo "Examples:" + echo " $0 informalsystems/quint v0.22.2" + echo " $0 --publish informalsystems/quint v0.22.2" exit 1 }