From 97f15bc5c240a602b83e822a48d47a3a764cae84 Mon Sep 17 00:00:00 2001 From: ludeeus Date: Thu, 19 Dec 2024 06:26:58 +0000 Subject: [PATCH] Add new release flow --- .github/release-drafter.yml | 8 --- .github/release.yml | 18 ++++++ .github/settings.yml | 23 -------- .github/workflows/release-drafter.yml | 27 --------- .github/workflows/release.yaml | 85 +++++++++++++++++---------- 5 files changed, 72 insertions(+), 89 deletions(-) delete mode 100644 .github/release-drafter.yml create mode 100644 .github/release.yml delete mode 100644 .github/settings.yml delete mode 100644 .github/workflows/release-drafter.yml diff --git a/.github/release-drafter.yml b/.github/release-drafter.yml deleted file mode 100644 index 2f50e90..0000000 --- a/.github/release-drafter.yml +++ /dev/null @@ -1,8 +0,0 @@ -change-template: '- #$NUMBER $TITLE @$AUTHOR' -sort-direction: ascending -exclude-labels: - - "release-drafter-ignore" -template: | - ## What’s Changed - - $CHANGES \ No newline at end of file diff --git a/.github/release.yml b/.github/release.yml new file mode 100644 index 0000000..0b6c3b5 --- /dev/null +++ b/.github/release.yml @@ -0,0 +1,18 @@ +changelog: + exclude: + labels: + - dependencies + categories: + - title: Breaking Changes πŸ›  + labels: + - breaking-change + - title: New Features πŸŽ‰ + labels: + - enhancement + - feature + - title: Bug fixes πŸ› + labels: + - bugfix + - title: Other Changes πŸ”„ + labels: + - "*" diff --git a/.github/settings.yml b/.github/settings.yml deleted file mode 100644 index 717c121..0000000 --- a/.github/settings.yml +++ /dev/null @@ -1,23 +0,0 @@ -repository: - private: false - has_issues: true - has_projects: false - has_wiki: false - has_downloads: false - default_branch: master - allow_squash_merge: true - allow_merge_commit: false - allow_rebase_merge: false -labels: - - name: "Feature Request" - color: "fbca04" - - name: "Bug" - color: "b60205" - - name: "Wont Fix" - color: "ffffff" - - name: "Enhancement" - color: a2eeef - - name: "Documentation" - color: "008672" - - name: "Stale" - color: "930191" \ No newline at end of file diff --git a/.github/workflows/release-drafter.yml b/.github/workflows/release-drafter.yml deleted file mode 100644 index 1a7879e..0000000 --- a/.github/workflows/release-drafter.yml +++ /dev/null @@ -1,27 +0,0 @@ -name: Release Drafter - -on: - push: - branches: - - main - -jobs: - release-drafter: - name: Release Drafter - runs-on: ubuntu-latest - steps: - - name: Checkout the repository - uses: actions/checkout@v4.2.2 - - - name: Get next version - id: version - run: | - echo "version=$(jq .version -r ./custom_components/healthchecksio/manifest.json)" >> $GITHUB_OUTPUT - - - name: Run Release Drafter - uses: release-drafter/release-drafter@v6.0.0 - with: - tag: ${{ steps.version.outputs.version }} - name: ${{ steps.version.outputs.version }} - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index 5451ce5..e07ba79 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -1,47 +1,70 @@ -name: Release Workflow +name: Release workflow on: - release: - types: [published] + push: + tags: + - "[0-9]{3}.[0-9]+.[0-9]+(?:b[0-9]+)?" + +premissions: {} jobs: - release: - name: Release + prepare: + name: Prepare runs-on: ubuntu-latest + if: startsWith(github.ref, 'refs/tags/') steps: - - name: πŸ“₯ Checkout the repository + - name: Checkout the repository uses: actions/checkout@v4.2.2 - - name: πŸ”’ Get release version - id: version - uses: home-assistant/actions/helpers/version@master - - - name: ℹ️ Get integration information - id: information - run: | - name=$(find custom_components/ -type d -maxdepth 1 | tail -n 1 | cut -d "/" -f2) - echo "::set-output name=name::$name" - - - name: πŸ‘€ Validate data + - name: Validate data + id: integration run: | - manifestversion=$(jq -r '.version' ${{ github.workspace }}/custom_components/${{ steps.information.outputs.name }}/manifest.json) - if [ "$manifestversion" != "${{ steps.version.outputs.version }}" ]; then - echo "The version in custom_components/${{ steps.information.outputs.name }}/manifest.json was not correct" + manifestversion=$(jq -r '.version' ./custom_components/healthchecksio/manifest.json) + if [ "$manifestversion" != "${{ github.ref_name }}" ]; then + echo "The version in custom_components/healthchecksio/manifest.json was not correct" echo "$manifestversion" exit 1 fi + echo "version=$manifestversion" >> $GITHUB_OUTPUT + + - name: Create zip file for the integration + run: | + cd "./custom_components/healthchecksio" + zip healthchecksio.zip -r ./ - - name: πŸ“¦ Create zip file for the integration + - name: Upload the zip file + uses: actions/upload-artifact@v4.5.0 + with: + name: healthchecksio.zip + + - name: Create summary run: | - cd "${{ github.workspace }}/custom_components/${{ steps.information.outputs.name }}" - zip ${{ steps.information.outputs.name }}.zip -r ./ + echo "### Release Preparation Summary" >> $GITHUB_STEP_SUMMARY + echo "- The integration has been prepared for release" >> $GITHUB_STEP_SUMMARY + echo "- Manifest version: ${{ steps.integration.outputs.version }}" >> $GITHUB_STEP_SUMMARY + echo "- Tag name: ${{ github.tag_name }}" >> $GITHUB_STEP_SUMMARY + + publish: + name: Publish + runs-on: ubuntu-latest + needs: prepare + environment: + name: publish + url: ${{ steps.release.outputs.url }} + premissions: + contents: write + steps: + - name: Download the zip file + uses: actions/download-artifact@v4.1.8 + with: + name: healthchecksio.zip - - name: πŸ“€ Upload the zipfile as a release asset - uses: actions/upload-release-asset@v1 - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + - name: Release + uses: softprops/action-gh-release@v2.2.0 + id: release with: - upload_url: ${{ github.event.release.upload_url }} - asset_path: "${{ github.workspace }}/custom_components/${{ steps.information.outputs.name }}/${{ steps.information.outputs.name }}.zip" - asset_name: ${{ steps.information.outputs.name }}.zip - asset_content_type: application/zip \ No newline at end of file + generate_release_notes: true + fail_on_unmatched_files: true + prerelease: contains(github.ref, '.0b') + files: | + healthchecksio.zip