diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..c7b94bd --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,47 @@ +name: release +on: + push: + branches: + - master + tags: + - 'v*.*.*' + +jobs: + release: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + + # Bump version on merging Pull Requests with specific labels. + # (bump:major,bump:minor,bump:patch) + - id: bumpr + if: "!startsWith(github.ref, 'refs/tags/')" + uses: haya14busa/action-bumpr@v1 + + # Update corresponding major and minor tag. + # e.g. Update v1 and v1.2 when releasing v1.2.3 + - uses: haya14busa/action-update-semver@v1 + if: "!steps.bumpr.outputs.skip" + with: + tag: ${{ steps.bumpr.outputs.next_version }} + + # Get tag name. + - id: tag + uses: haya14busa/action-cond@v1 + with: + cond: "${{ startsWith(github.ref, 'refs/tags/') }}" + if_true: ${{ github.ref }} + if_false: ${{ steps.bumpr.outputs.next_version }} + + # Create release. + - uses: actions/create-release@v1 + if: "steps.tag.outputs.value != ''" + env: + # This token is provided by Actions, you do not need to create your own token + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + tag_name: ${{ steps.tag.outputs.value }} + release_name: Release ${{ steps.tag.outputs.value }} + body: ${{ steps.bumpr.outputs.message }} + draft: false + prerelease: false diff --git a/.github/workflows/update_semver.yml b/.github/workflows/update_semver.yml deleted file mode 100644 index 8e832ec..0000000 --- a/.github/workflows/update_semver.yml +++ /dev/null @@ -1,15 +0,0 @@ -name: Update Semver -on: - push: - branches-ignore: - - '**' - tags: - - 'v*.*.*' -jobs: - update-semver: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v2 - - uses: haya14busa/action-update-semver@v1 - with: - github_token: ${{ secrets.github_token }}