From f5fd84419b4bb007ea9e8ee716099cddb5fd38ab Mon Sep 17 00:00:00 2001 From: ArthurKun <16458204+ArthurKun21@users.noreply.github.com> Date: Thu, 31 Jul 2025 22:17:04 +0800 Subject: [PATCH] Replace get-latest-release action with github cli (#41) * ci: replace the get-latest-release action with github cli * fix: handle if empty release * chore: remove redundant env * ci: further shorten the ci build * ci: update and reduce build step * Update .github/workflows/build.yml Co-authored-by: stevenyomi <95685115+stevenyomi@users.noreply.github.com> * Update .github/workflows/build.yml Co-authored-by: AntsyLich <59261191+AntsyLich@users.noreply.github.com> --------- Co-authored-by: stevenyomi <95685115+stevenyomi@users.noreply.github.com> Co-authored-by: AntsyLich <59261191+AntsyLich@users.noreply.github.com> --- .github/workflows/build.yml | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index a555857..0a7b633 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -19,7 +19,6 @@ jobs: build: name: Build app runs-on: 'ubuntu-24.04' - steps: - name: Clone Repository (Latest) uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 @@ -58,14 +57,6 @@ jobs: env: BUILD_TOOLS_VERSION: '35.0.1' - - name: Get previous release - id: last_release - uses: InsonusK/get-latest-release@7a9ff16c8c6b7ead5d71c0f1cc61f2703170eade # v1.1.0 - with: - myToken: ${{ github.token }} - exclude_types: 'draft|prerelease' - view_top: 1 - - name: Prepare changelog run: | set -e @@ -75,7 +66,15 @@ jobs: current_sha=$(git rev-parse --short HEAD) echo "CURRENT_SHA=$current_sha" >> $GITHUB_ENV - prev_commit_count=$(echo "${{ steps.last_release.outputs.tag_name }}" | sed -e "s/^r//") + tag_name=$(gh release list --repo mihonapp/mihon-preview --exclude-drafts --exclude-pre-releases --json tagName --limit 1 --jq 'select(length > 0) | .[0].tagName') + if [ -n "$tag_name" ]; then + echo "Latest Tag: $tag_name" + else + echo "Failed to get repository information" + exit 1 + fi + + prev_commit_count=$(echo "$tag_name" | sed -e "s/^r//") commit_count_diff=$(expr $commit_count - $prev_commit_count) prev_release_sha=$(git rev-parse --short HEAD~$commit_count_diff) echo "PREV_RELEASE_SHA=$prev_release_sha" >> $GITHUB_ENV