Skip to content

Update release.yml

Update release.yml #3

Workflow file for this run

name: Release on Tag
on:
push:
tags:
- '*'
jobs:
create-release:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v2
- name: Get the previous tag
id: prev-tag
run: echo "::set-output name=prev-tag::$(git describe --tags --abbrev=0 HEAD^1)"
- name: Get commits since previous tag
id: commits
run: echo "::set-output name=commits::$(git log ${{ steps.prev-tag.outputs.prev-tag }}..HEAD --pretty=format:'%h %s')"
- name: Create Release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ github.ref }}
release_name: ${{ github.ref }}
body: |
${{ steps.commits.outputs.commits }}
- name: Update CHANGELOG.md
run: |
echo "## ${{ github.ref }} - $(date +'%B %d, %Y')" > new_changelog.md
echo "${{ steps.commits.outputs.commits }}" >> new_changelog.md
cat CHANGELOG.md >> new_changelog.md
mv new_changelog.md CHANGELOG.md
git config --global user.name 'github-actions[bot]'
git config --global user.email 'github-actions[bot]@users.noreply.github.com'
git add CHANGELOG.md
git commit -m "Update CHANGELOG.md for ${{ github.ref }}"
- name: Push changes
run: |
git branch update-changelog
git push origin update-changelog