Skip to content

Create Release

Create Release #11

name: Create Release
env:
MILESTONE: ${{ github.event.milestone.title }}
on:
milestone:
types:
- closed
jobs:
generate-changelog:
name: Generate Changelog
runs-on: ubuntu-latest
outputs:
changelog: ${{ steps.changelog.outputs.changelog }}
steps:
- name: Generate changelog
uses: WyriHaximus/github-action-jwage-changelog-generator@v1
id: changelog
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
milestone: ${{ env.MILESTONE }}
- name: Show changelog
run: echo "${CHANGELOG}"
env:
CHANGELOG: ${{ steps.changelog.outputs.changelog }}
create-release:
name: Create Release
needs:
- generate-changelog
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0 # Required due to the way Git works, without it this action won't be able to find any or the correct tags
- name: Create release/${{ env.MILESTONE }} branch
run: git checkout -b release/${{ env.MILESTONE }} ${GITHUB_SHA}
- run: echo -e "${CHANGELOG}" > release-${{ env.MILESTONE }}-changelog.md
env:
CHANGELOG: ${{ needs.generate-changelog.outputs.changelog }}
- run: |
echo -e "${MILESTONE_DESCRIPTION}\r\n\r\n${CHANGELOG}" > release-${{ env.MILESTONE }}-release-message.md
cat release-${{ env.MILESTONE }}-release-message.md
release_message=$(cat release-${{ env.MILESTONE }}-release-message.md)
release_message="${release_message//'%'/'%25'}"
release_message="${release_message//$'\n'/'%0A'}"
release_message="${release_message//$'\r'/'%0D'}"
echo "::set-output name=release_message::$release_message"
id: releasemessage
env:
MILESTONE_DESCRIPTION: ${{ github.event.milestone.description }}
CHANGELOG: ${{ needs.generate-changelog.outputs.changelog }}
- name: Create release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ env.MILESTONE }}
release_name: ${{ env.MILESTONE }}
body: ${{ steps.releasemessage.outputs.release_message }}
draft: false
prerelease: false
- name: Updated related tags
uses: haya14busa/action-update-semver@v1
with:
tag: ${{ env.MILESTONE }}