From b4a03a3324732877a258cf225c9c9ddf0d99026a Mon Sep 17 00:00:00 2001 From: Teodora Sandu Date: Mon, 11 Mar 2024 15:23:52 +0000 Subject: [PATCH] chore: gh release --- .github/release.yml | 17 +++++++++++++++++ .github/workflows/labels.yml | 13 +++++++++++++ .github/workflows/release.yml | 30 ++++++++++++++++++++++++++++++ CONTRIBUTING.md | 9 +++++++++ 4 files changed, 69 insertions(+) create mode 100644 .github/release.yml create mode 100644 .github/workflows/labels.yml create mode 100644 .github/workflows/release.yml diff --git a/.github/release.yml b/.github/release.yml new file mode 100644 index 0000000..e61ca89 --- /dev/null +++ b/.github/release.yml @@ -0,0 +1,17 @@ +changelog: + exclude: + labels: + - ignore-for-release + categories: + - title: Breaking Changes 🛠 + labels: + - breaking + - title: Exciting New Features 🎉 + labels: + - feature + - title: Fixes 🔧 + labels: + - fix + - title: Other Changes + labels: + - "*" \ No newline at end of file diff --git a/.github/workflows/labels.yml b/.github/workflows/labels.yml new file mode 100644 index 0000000..04b6bed --- /dev/null +++ b/.github/workflows/labels.yml @@ -0,0 +1,13 @@ +name: PR labels +on: + pull_request: + types: [ opened, reopened, edited, labeled, unlabeled ] + branches: + - 'main' + +jobs: + build: + runs-on: ubuntu-latest + steps: + - name: Create labels for CHANGELOG + uses: bcoe/conventional-release-labels@v1 \ No newline at end of file diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..4c8b581 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,30 @@ +name: Release +on: + push + branches: + - 'main' + +jobs: + build: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + with: + ref: ${{ github.event.pull_request.merge_commit_sha }} + fetch-depth: '0' + + - uses: paulhatch/semantic-version@v5.3.0 + id: semantic_version + with: + tag_prefix: "v" + + - name: Create tag + run: git tag ${{ steps.semantic_version.outputs.version }} + + - name: Push tag + run: git push --tags + + - name: Release + run: gh release create ${{ steps.semantic_version.outputs.version }} --generate-notes + env: + GH_TOKEN: ${{ github.token }} \ No newline at end of file diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 78ff53f..bd1d9fe 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -122,3 +122,12 @@ git push ``` Do not hold onto your changes for too long. Commit and push frequently and create a pull request as soon as possible for backup and visibility. + +## Creating PRs + +We use a [GitHub Action](https://github.com/marketplace/actions/conventional-release-labels) to generate labels which are then used to generate the relase notes when merging the PR. + +## Merging PRs + +We use a [GitHub Action](https://github.com/PaulHatch/semantic-version) to compute the version based on conventional commit messages, push a tag with the computed version, then use +the [GitHub Release CLI](https://cli.github.com/manual/gh_release_create) to generate release notes based on labels. \ No newline at end of file