diff --git a/.github/release.yml b/.github/release.yml new file mode 100644 index 0000000..9cc2790 --- /dev/null +++ b/.github/release.yml @@ -0,0 +1,26 @@ +changelog: + categories: + - title: Features + labels: [feat] + - title: Fixes + labels: [fix] + - title: Performance + labels: [perf] + - title: Reverts + labels: [revert] + - title: Documentation + labels: [docs] + - title: Refactors + labels: [refactor] + - title: Style + labels: [style] + - title: Tests + labels: [test] + - title: Build + labels: [build] + - title: Continuous integration + labels: [ci] + - title: Chores + labels: [chore] + - title: Other changes + labels: ["*"] diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..ad33d66 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,53 @@ +name: Release + +on: + push: + branches: [main] + tags: ['v*'] + +permissions: + contents: write + +concurrency: + group: release + cancel-in-progress: false + +jobs: + draft: + name: Update the draft release + if: startsWith(github.ref, 'refs/heads/') + runs-on: ubuntu-latest + env: + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} + GH_REPO: ${{ github.repository }} + steps: + - name: Replace the draft release + run: | + if gh release view unreleased >/dev/null 2>&1; then + gh release delete unreleased --yes + fi + gh release create unreleased \ + --draft \ + --target "${{ github.sha }}" \ + --title "Unreleased" \ + --generate-notes + + release: + name: Publish the release + if: startsWith(github.ref, 'refs/tags/') + runs-on: ubuntu-latest + env: + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} + GH_REPO: ${{ github.repository }} + steps: + - name: Create the release + run: | + gh release create "${{ github.ref_name }}" \ + --title "${{ github.ref_name }}" \ + --generate-notes + + - name: Remove the stale draft release + run: | + if gh release view unreleased >/dev/null 2>&1; then + gh release delete unreleased --yes + fi