chore: storing version and changelog #216
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Create a new release on main automatically based on conventional commit messages | |
name: "Release" | |
on: | |
push: | |
branches: | |
- main | |
jobs: | |
release: | |
if: "github.event.head_commit.message != 'chore: storing version and changelog'" | |
name: Releasing a new version | |
runs-on: ubuntu-latest | |
steps: | |
- name: Set token for protected branch pusher app | |
id: app | |
uses: getsentry/action-github-app-token@v2 | |
with: | |
app_id: ${{ secrets.PROTECTEDBRANCHPUSHER_APP_ID }} | |
private_key: ${{ secrets.PROTECTEDBRANCHPUSHER_PRIVATE_KEY }} | |
- uses: actions/checkout@v2 | |
with: | |
fetch-depth: 0 | |
token: "${{ steps.app.outputs.token }}" | |
- name: Calculate version | |
id: calculate_version | |
uses: mathieudutour/[email protected] | |
with: | |
github_token: "${{ steps.app.outputs.token }}" | |
dry_run: true | |
default_bump: false | |
- name: "Write changelog" | |
run: | | |
CHANGELOG="" | |
if [ -e CHANGELOG.md ] | |
then | |
CHANGELOG=$(cat CHANGELOG.md) | |
fi | |
echo -e "${{steps.calculate_version.outputs.changelog}}\n\n${CHANGELOG}" > CHANGELOG.md | |
if: steps.calculate_version.outputs.new_version != '' | |
- name: "Commit" | |
id: "commit" | |
uses: EndBug/[email protected] | |
with: | |
message: 'chore: storing version and changelog' | |
push: true | |
if: steps.calculate_version.outputs.new_version != '' | |
- name: Create Release | |
uses: ncipollo/[email protected] | |
with: | |
commit: ${{ steps.commit.outputs.commit_long_sha }} | |
tag: ${{ steps.calculate_version.outputs.new_tag }} | |
name: ${{ steps.calculate_version.outputs.new_tag }} | |
body: ${{ steps.calculate_version.outputs.changelog }} | |
token: "${{ steps.app.outputs.token }}" | |
if: steps.calculate_version.outputs.new_version != '' |