diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index 0b2fb28..4c02fde 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -2,33 +2,42 @@ name: Release on: workflow_call: - inputs: - tag: - type: string - required: true secrets: token: required: true jobs: + get-tag: + name: Get tag + runs-on: ubuntu-latest + outputs: + tag: ${{ steps.get-tag-step.outputs.tag }} + steps: + - name: Get tag + run: | + branch=${{github.event.workflow_run.head_branch}} + echo tag=${branch#release/} >> $GITHUB_OUTPUT + id: get-tag-step + create-release: name: Create release + needs: get-tag runs-on: ubuntu-latest steps: - name: Checkout repository uses: actions/checkout@v2 with: ref: refs/heads/${{github.event.workflow_run.head_branch}} - - name: Push tag ${{ inputs.tag }} + - name: Push tag ${{ needs.get-tag.outputs.tag }} run: | git status - git tag ${{ inputs.tag }} - git push origin ${{ inputs.tag }} -f - - name: Create release ${{ inputs.tag }} + git tag ${{ needs.get-tag.outputs.tag }} + git push origin ${{ needs.get-tag.outputs.tag }} -f + - name: Create release ${{ needs.get-tag.outputs.tag }} uses: actions/create-release@v1 env: GITHUB_TOKEN: ${{ secrets.token }} with: - tag_name: refs/tags/${{ inputs.tag }} - release_name: ${{ inputs.tag }} + tag_name: refs/tags/${{ needs.get-tag.outputs.tag }} + release_name: ${{ needs.get-tag.outputs.tag }} draft: false prerelease: false