I want GitHub Action to create a Change Log and Release Tag when a pull request is merged to the master branch.The current code I have below seems to be creating a version tag out of order and not creating a release.
name: Changelog & Releases
on:
push:
branches:
- master
- name: Changelog Action
id: changelog
uses: TriPSs/conventional-changelog-action@v3
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
- name: create release
uses: actions/create-release@v1
if: ${{ steps.changelog.outputs.skipped == 'false'}}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ steps.changelog.outputs.tag }}
release_name: ${{ steps.changelog.outputs.tag }}
body: ${{ steps.changelog.outputs.clean_changelog }}
Here is a working Github Actions workflow that I use with one of my release pipelines.
This is exactly the same as your use case. So feel free to use it.
The release action that you are using is currently unmaintained, so use the one that I've mentioned in the workflow below.
name: Release using conventional commits (master branch)
on:
push:
branches:
- master
jobs:
release:
runs-on: ubuntu-latest
steps:
- name: checkout
uses: actions/checkout@v2
- name: conventional changelog action
id: changelog
# https://github.com/TriPSs/conventional-changelog-action
uses: TriPSs/conventional-changelog-action@latest
with:
# you can also create separate token to trace action
github-token: "${{ secrets.GITHUB_TOKEN }}"
- name: create release
# https://github.com/actions/create-release
uses: softprops/action-gh-release@v1
if: ${{steps.changelog.outputs.skipped == 'false'}}
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.changelog.outputs.tag }}
name: ${{ steps.changelog.outputs.tag }}
body: ${{steps.changelog.outputs.clean_changelog}}
draft: false
prerelease: false