Release - Bump and Release #33
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
name: Release - Bump and Release | |
on: [workflow_dispatch] | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.ref }} | |
cancel-in-progress: true | |
jobs: | |
create_release_draft: | |
name: Create the release draft | |
runs-on: ubuntu-latest | |
permissions: | |
contents: write | |
pull-requests: write | |
steps: | |
- name: ⤵️ Checkout code | |
uses: actions/checkout@v3 | |
with: | |
ref: ${{ github.ref }} | |
- name: 🗑 Delete drafts | |
uses: hugo19941994/[email protected] | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- name: 📝 Draft release | |
uses: release-drafter/release-drafter@v5 | |
id: release_drafter | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- name: 🔄 Update version in 'VERSION' and 'manifest.json' and push changes | |
env: | |
tag_name: ${{ steps.release_drafter.outputs.tag_name }} | |
GITHUB_REPO: ${{ github.event.repository.name }} | |
run: | | |
echo "** Manifest before replace **" | |
cat custom_components/$GITHUB_REPO/manifest.json | |
sed -i 's/"version": ".*"/"version": "'$tag_name'"/g' custom_components/$GITHUB_REPO/manifest.json | |
echo "** Manifest after replace **" | |
cat custom_components/$GITHUB_REPO/manifest.json | |
echo $tag_name > VERSION | |
- name: 🚀 Add and commit changes | |
uses: EndBug/add-and-commit@v9 | |
with: | |
message: Bump version | |
- name: 📝 Publish release | |
uses: release-drafter/release-drafter@v5 | |
id: release_published | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
publish: true | |
- name: "✏️ Generate release changelog" | |
uses: heinrichreimer/[email protected] | |
with: | |
token: ${{ secrets.GH_PAT }} | |
issues: true | |
issuesWoLabels: true | |
pullRequests: true | |
prWoLabels: true | |
unreleased: false | |
addSections: '{"documentation":{"prefix":"**Documentation:**","labels":["documentation"]}}' | |
- name: ✅ Commit release notes | |
uses: EndBug/add-and-commit@v9 | |
with: | |
message: Commit release notes | |
- name: Discord notification | |
env: | |
tag_name: ${{ steps.release_drafter.outputs.tag_name }} | |
DISCORD_WEBHOOK: ${{ secrets.DISCORD_WEBHOOK }} | |
uses: Ilshidur/action-discord@master | |
with: | |
args: "New release published: https://github.com/{{ EVENT_PAYLOAD.repository.full_name }}/releases/tag/{{tag_name}}" |