Skip to content

Commit

Permalink
chore(actions): fix tag extraction bug in Actions
Browse files Browse the repository at this point in the history
`context.ref.replace(/^refs\/tags\//, '')` will output like "v0.3.0", but we need v0.3.0.

Use github.ref_name instead.
  • Loading branch information
taoky committed Mar 13, 2022
1 parent dbb6693 commit dde2706
Showing 1 changed file with 2 additions and 10 deletions.
12 changes: 2 additions & 10 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -59,23 +59,15 @@ jobs:
GOOS: ${{ matrix.GOOS }}
GOARCH: ${{ matrix.GOARCH }}

- name: Deploy - Extract tag name
id: tag
uses: actions/github-script@v3
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
script: |
return context.ref.replace(/^refs\/tags\//, '');
- name: Deploy - Create Release
if: startsWith(github.ref, 'refs/tags/')
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ steps.tag.outputs.result }}
release_name: ${{ steps.tag.outputs.result }}
tag_name: ${{ github.ref_name }}
release_name: ${{ github.ref_name }}
draft: false
prerelease: false

Expand Down

0 comments on commit dde2706

Please sign in to comment.