From 3b04d8ecc6317af5331e051d11b4224f50c6a537 Mon Sep 17 00:00:00 2001 From: gtxaspec Date: Wed, 20 Nov 2024 19:03:12 -0800 Subject: [PATCH] workflow: update release logic --- .github/workflows/firmware.yaml | 24 ++++++++++++++++++++++-- 1 file changed, 22 insertions(+), 2 deletions(-) diff --git a/.github/workflows/firmware.yaml b/.github/workflows/firmware.yaml index 4461faa0f..16a157650 100644 --- a/.github/workflows/firmware.yaml +++ b/.github/workflows/firmware.yaml @@ -40,6 +40,7 @@ env: TG_CHANNEL_SCRATCH: ${{secrets.TELEGRAM_CHANNEL_THINGINO_SCRATCH}} TG_OPTIONS: -s FORCE_UNSAFE_CONFIGURE: 1 + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} jobs: notify-begin: @@ -119,7 +120,7 @@ jobs: - name: Install build dependencies run: | - apt-get install -y --no-install-recommends --no-install-suggests build-essential bc cmake cpio curl ca-certificates file git make gawk procps rsync u-boot-tools unzip wget + apt-get install -y --no-install-recommends --no-install-suggests build-essential bc cmake cpio curl ca-certificates file git make gawk jq procps rsync u-boot-tools unzip wget - name: Setup gh workspace in container run: git config --global --add safe.directory "$GITHUB_WORKSPACE" @@ -224,7 +225,7 @@ jobs: uses: softprops/action-gh-release@master with: tag_name: ${{ env.TAG_NAME }} - make_latest: true + make_latest: false files: | ${{ env.FULL_FW }} ${{ env.FULL_FW_SHA }} @@ -265,6 +266,25 @@ jobs: - name: Setup Environment run: | echo "TG_DISABLED=${{ github.event.inputs.tg_disabled || 'false' }}" >> $GITHUB_ENV + echo "TAG_NAME=$TAG_NAME-$(date +'%Y-%m-%d')" >> $GITHUB_ENV + + - name: Checkout source + uses: actions/checkout@v4 + with: + submodules: 'true' + ref: "master" + fetch-depth: "1" + + - name: Get release ID and Mark as Latest + run: | + RELEASE_URL=$(gh release view ${{ env.TAG_NAME }} --json url -q ".url") + + if [[ -n "$RELEASE_URL" ]]; then + gh release edit ${{ env.TAG_NAME }} --prerelease false --draft false --latest true + echo "Release marked as latest" + else + echo "Release not found, skipping latest release update" + fi - name: Send completion summary if: ${{ env.TG_DISABLED == 'false' }}