diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 752f555..40c023f 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -4,6 +4,7 @@ on: push: tags: - "[0-9]+.[0-9]+.[0-9]+-[0-9]+" + pull_request: permissions: contents: write @@ -12,9 +13,12 @@ jobs: upload-assets: runs-on: ubuntu-latest steps: + - uses: actions/checkout@v4 + with: + fetch-depth: 0 - id: get-upstream-tag run: | - tag=$(echo ${{ github.ref_name }} | cut -d- -f1) + tag=$(echo ${{ startsWith(github.ref, 'refs/tags/') && github.ref_name || '$(git describe --tags --abbrev=0)' }} | cut -d- -f1) echo "::set-output name=tag::$tag" - uses: actions/checkout@v4 with: @@ -39,6 +43,7 @@ jobs: run: | riscv64-linux-gnu-strip out/rg - name: Release + if: startsWith(github.ref, 'refs/tags/') uses: softprops/action-gh-release@v2 with: files: out/rg