From 9b9262b3cb1dff82161b260356e649c7bc734a39 Mon Sep 17 00:00:00 2001 From: Clement Tsang <34804052+ClementTsang@users.noreply.github.com> Date: Sat, 20 Dec 2025 21:34:11 -0500 Subject: [PATCH] ci: test workaround to immutable release issue on nightly (#1907) Workaround is to create nightly as a draft and then use `gh` to manually publish it after. Also a lot of other small fixes. --- .github/workflows/nightly.yml | 39 ++++++++++++++++--- README.md | 4 +- .../development/deploy_process.md | 2 +- 3 files changed, 37 insertions(+), 8 deletions(-) diff --git a/.github/workflows/nightly.yml b/.github/workflows/nightly.yml index c83a8e40..37af6332 100644 --- a/.github/workflows/nightly.yml +++ b/.github/workflows/nightly.yml @@ -76,22 +76,51 @@ jobs: - name: Delete tag and release if not mock if: github.event.inputs.isMock != 'true' - run: gh release delete nightly --cleanup-tag + run: | + while true; do + PREV_NIGHTLY=$(gh release list --json name,tagName | jq -c '[.[] | select (.tagName | contains("nightly-"))][0] | .tagName' | tr -d '"') + + if [[ "$PREV_NIGHTLY" != "null" && "$PREV_NIGHTLY" == *"nightly-"* ]]; then + echo "Will delete nightly release with tag '$PREV_NIGHTLY'"; + gh release delete $PREV_NIGHTLY --cleanup-tag || { echo "couldn't delete previous nightly release, halting"; break; } + else + echo "no nightly releases left, done"; + break; + fi + done env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - - name: Sleep for a few seconds to prevent timing issues between the deletion and creation of the release - run: sleep 10 + - name: Create and set tag name and release name if: github.event.inputs.isMock != 'true' + run: | + COMMIT_HASH=$(git rev-parse --short=8 HEAD) + TIME=$(date +%s) + TAG_NAME=$(echo "nightly-$COMMIT_HASH-$TIME") + echo "TAG_NAME=$TAG_NAME" >> $GITHUB_ENV + echo "$TAG_NAME" + DATE=$(date '+%Y-%m-%d') + RELEASE_NAME=$(echo "Nightly ($DATE)") + echo "RELEASE_NAME=$RELEASE_NAME" >> $GITHUB_ENV + echo "$RELEASE_NAME" + + # As a workaround to immutable releases, we create it as a draft first, then manually publish it after. - name: Add all release files and create nightly release if not mock uses: softprops/action-gh-release@c062e08bd532815e2082a85e87e3ef29c3e6d191 # 2.0.8 if: github.event.inputs.isMock != 'true' with: token: ${{ secrets.GITHUB_TOKEN }} prerelease: true - tag_name: "nightly" - draft: false + tag_name: ${{ env.TAG_NAME }} + draft: true fail_on_unmatched_files: true + name: ${{ env.RELEASE_NAME }} files: | ./release/* + + - name: Publish the draft release + if: github.event.inputs.isMock != 'true' + run: gh release edit "$TAG_NAME" --draft=false + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/README.md b/README.md index 07b2e4d1..e20ef2b8 100644 --- a/README.md +++ b/README.md @@ -212,7 +212,7 @@ yay -S bottom-git ### Debian / Ubuntu A `.deb` file is provided on each [stable release](https://github.com/ClementTsang/bottom/releases/latest) and -[nightly builds](https://github.com/ClementTsang/bottom/releases/tag/nightly) for x86, aarch64, and armv7. +[nightly builds](https://github.com/ClementTsang/bottom/releases) for x86, aarch64, and armv7. Some examples of installing it this way: ```bash @@ -413,7 +413,7 @@ mise use -g bottom@latest You can also use the pre-built release binaries: - [Latest stable release](https://github.com/ClementTsang/bottom/releases/latest), built using the release branch -- [Latest nightly release](https://github.com/ClementTsang/bottom/releases/tag/nightly), built using the `main` branch at 00:00 UTC daily +- [Latest nightly release](https://github.com/ClementTsang/bottom/releases), built using the `main` branch at 00:00 UTC daily To use, download and extract the binary that matches your system. You can then run by doing: diff --git a/docs/content/contribution/development/deploy_process.md b/docs/content/contribution/development/deploy_process.md index ff660c68..d5bc59b9 100644 --- a/docs/content/contribution/development/deploy_process.md +++ b/docs/content/contribution/development/deploy_process.md @@ -12,7 +12,7 @@ bottom currently has two main deploy processes to worry about: -- [Nightly](https://github.com/ClementTsang/bottom/blob/main/.github/workflows/nightly.yml): a daily (00:00 UTC) GitHub action to build binary/installer files, and upload them to the [nightly release](https://github.com/ClementTsang/bottom/releases/tag/nightly). It can also be triggered manually as either a proper nightly release or a mock release. +- [Nightly](https://github.com/ClementTsang/bottom/blob/main/.github/workflows/nightly.yml): a daily (00:00 UTC) GitHub action to build binary/installer files, and upload them to the [nightly release](https://github.com/ClementTsang/bottom/releases). It can also be triggered manually as either a proper nightly release or a mock release. - [Stable](https://github.com/ClementTsang/bottom/blob/main/.github/workflows/deployment.yml): a stable deployment, triggered manually or upon creation of a valid tag. This is a GitHub action that builds binary/installer files and uploads them to a new GitHub release. Furthermore, this workflow does not handle the following deployments, which must be manually handled: