diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index e3de7bc..e126f21 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -24,6 +24,17 @@ jobs: path: temp show-progress: false + - name: Fetch history + if: ${{ !startsWith(github.ref, 'refs/pull/') }} + run: | + git init + cp $GITHUB_WORKSPACE/temp/.git/config ./.git + rm -rf $GITHUB_WORKSPACE/temp + # git config remote.origin.fetch '+refs/*:refs/*' + git fetch --filter=tree:0 # --update-head-ok + git reset --hard origin/$(git branch --show-current) || true + git checkout ${{ github.ref_name }} + - name: Set tag id: set_tag run: | @@ -31,6 +42,16 @@ jobs: echo tag=$(git describe --tags --match "v*" ${{ github.ref }} || git rev-parse --short HEAD) | tee -a $GITHUB_OUTPUT exit ${PIPESTATUS[0]} + - name: Judge pre-release + id: set_pre + if: ${{ startsWith(github.ref, 'refs/tags/v') }} + run: | + if [[ '${{ steps.set_tag.outputs.tag }}' =~ ^v[0-9]+\.[0-9]+\.[0-9]+$ ]]; then + echo prerelease=false | tee -a $GITHUB_OUTPUT + else + echo prerelease=true | tee -a $GITHUB_OUTPUT + fi + - name: Set up Node.js uses: actions/setup-node@v4 with: