From 8e7d52906454e6d50a0a1b896216007ef86a3cba Mon Sep 17 00:00:00 2001 From: Eddie Knight Date: Thu, 25 Apr 2024 21:40:36 -0500 Subject: [PATCH 1/4] ci: added release drafter and pr linter --- .github/dependabot.yml | 26 ++++++++++++++ .github/release-drafter.yml | 67 +++++++++++++++++++++++++++++++++++ .github/workflows/pr-lint.yml | 44 +++++++++++++++++++++++ .github/workflows/release.yml | 53 +++++++++++++++++++++++++++ 4 files changed, 190 insertions(+) create mode 100644 .github/dependabot.yml create mode 100644 .github/release-drafter.yml create mode 100644 .github/workflows/pr-lint.yml create mode 100644 .github/workflows/release.yml diff --git a/.github/dependabot.yml b/.github/dependabot.yml new file mode 100644 index 00000000..edb72bff --- /dev/null +++ b/.github/dependabot.yml @@ -0,0 +1,26 @@ +--- +version: 2 +updates: + - package-ecosystem: "github-actions" + directory: / + schedule: + interval: "weekly" + timezone: "America/Los_Angeles" + labels: + - "dependabot" + - "dependencies" + - "github-actions" + commit-message: + prefix: "chore(deps)" + + - package-ecosystem: "npm" # See documentation for possible values + directory: / + schedule: + interval: "weekly" + timezone: "America/Los_Angeles" + labels: + - "dependabot" + - "dependencies" + - "npm" + commit-message: + prefix: "chore(deps)" diff --git a/.github/release-drafter.yml b/.github/release-drafter.yml new file mode 100644 index 00000000..d7b6c666 --- /dev/null +++ b/.github/release-drafter.yml @@ -0,0 +1,67 @@ +--- +name-template: 'v$RESOLVED_VERSION' +tag-template: 'v$RESOLVED_VERSION' +change-template: '- $TITLE @$AUTHOR (#$NUMBER)' +template: | + # Changelog + $CHANGES + + --- + + See details of [all code changes](https://github.com/finos/git-proxy/compare/$PREVIOUS_TAG...v$RESOLVED_VERSION) since previous release + +categories: + - title: '🚀 Features' + labels: + - 'enhancement' + - 'feature' + - title: '🐛 Bug Fixes' + labels: + - 'fix' + - title: '🧰 Maintenance' + labels: + - 'infrastructure' + - 'automation' + - 'documentation' + - 'dependencies' + - 'maintenance' + - 'revert' +version-resolver: + major: + labels: + - 'breaking' + minor: + labels: + - 'enhancement' + - 'feature' + patch: + labels: + - 'fix' + - 'documentation' + - 'maintenance' + default: patch +autolabeler: + - label: 'automation' + title: + - '/^(ci|perf|refactor|test).*/i' + - label: 'enhancement' + title: + - '/^(style).*/i' + - label: 'documentation' + title: + - '/^(docs).*/i' + - label: 'feature' + title: + - '/^(feat|break).*/i' + - label: 'fix' + title: + - '/^(fix).*/i' + - label: 'infrastructure' + title: + - '/^(infrastructure).*/i' + - label: 'maintenance' + title: + - '/^(chore|maintenance).*/i' + - label: 'revert' + title: + - '/^(revert).*/i' diff --git a/.github/workflows/pr-lint.yml b/.github/workflows/pr-lint.yml new file mode 100644 index 00000000..cc848d33 --- /dev/null +++ b/.github/workflows/pr-lint.yml @@ -0,0 +1,44 @@ +## Reference: https://github.com/amannn/action-semantic-pull-request +--- +name: "Lint PR" + +on: + pull_request_target: + types: + - opened + - reopened + - edited + - synchronize + +permissions: + contents: read + +jobs: + pr_title: + permissions: + pull-requests: write + statuses: write + name: Validate & Label PR + runs-on: ubuntu-latest + steps: + - uses: amannn/action-semantic-pull-request@v5 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + # Configure which types are allowed (newline-delimited). + # From: https://github.com/commitizen/conventional-commit-types/blob/master/index.json + # listing all below + types: | + chore + ci + docs + feat + fix + perf + refactor + revert + test + break + - uses: release-drafter/release-drafter@v5 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 00000000..8280f7b9 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,53 @@ +--- +name: Release + +on: + workflow_dispatch: + push: + branches: + - main + +permissions: + contents: read + +jobs: + create_github_release: + outputs: + full-tag: ${{ steps.release-drafter.outputs.tag_name }} + short-tag: ${{ steps.get_tag_name.outputs.SHORT_TAG }} + body: ${{ steps.release-drafter.outputs.body }} + runs-on: ubuntu-latest + permissions: + contents: write + pull-requests: read + steps: + - uses: release-drafter/release-drafter@v6 + id: release-drafter + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + publish: true + - name: Get the short tag + id: get_tag_name + run: | + short_tag=$(echo ${{ steps.release-drafter.outputs.tag_name }} | cut -d. -f1) + echo "SHORT_TAG=$short_tag" >> $GITHUB_OUTPUT + create_npm_release: + if: github.event.pull_request.head.repo.full_name == github.repository # Everything but this step can be tested on a fork + needs: create_github_release + runs-on: ubuntu-latest + permissions: + packages: write + env: + REGISTRY: ghcr.io + IMAGE_NAME: ${{ github.repository }} + steps: + - uses: actions/checkout@8459bc0 # v4 + - uses: actions/setup-node@c2ac33f # v4, Setup .npmrc file to publish to npm + with: + node-version: '18.x' + registry-url: 'https://registry.npmjs.org' + - run: npm ci + - run: npm publish --access=public + env: + NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} From ccefe00f2b3131e3315d4fcb2cd6bee335f8de14 Mon Sep 17 00:00:00 2001 From: Eddie Knight Date: Thu, 25 Apr 2024 21:53:03 -0500 Subject: [PATCH 2/4] fix(ci): Corrected breaking->major Signed-off-by: Eddie Knight --- .github/release-drafter.yml | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/.github/release-drafter.yml b/.github/release-drafter.yml index d7b6c666..f6cee27b 100644 --- a/.github/release-drafter.yml +++ b/.github/release-drafter.yml @@ -7,7 +7,7 @@ template: | $CHANGES --- - + See details of [all code changes](https://github.com/finos/git-proxy/compare/$PREVIOUS_TAG...v$RESOLVED_VERSION) since previous release categories: @@ -52,7 +52,10 @@ autolabeler: - '/^(docs).*/i' - label: 'feature' title: - - '/^(feat|break).*/i' + - '/^(feat).*/i' + - label: 'breaking' + title: + - '/^(break).*/i' - label: 'fix' title: - '/^(fix).*/i' From ace3d17031828e09a70cc4ac892dda1f5ab0645e Mon Sep 17 00:00:00 2001 From: Eddie Knight Date: Thu, 25 Apr 2024 22:01:39 -0500 Subject: [PATCH 3/4] Changed workflow name Signed-off-by: Eddie Knight --- .github/workflows/pr-lint.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/pr-lint.yml b/.github/workflows/pr-lint.yml index cc848d33..454586d0 100644 --- a/.github/workflows/pr-lint.yml +++ b/.github/workflows/pr-lint.yml @@ -1,6 +1,6 @@ ## Reference: https://github.com/amannn/action-semantic-pull-request --- -name: "Lint PR" +name: "PR" on: pull_request_target: From e3711668c9bd1d41e7f82b415a62ffd34f69235f Mon Sep 17 00:00:00 2001 From: Eddie Knight Date: Fri, 3 May 2024 08:18:06 -0500 Subject: [PATCH 4/4] Delete .github/dependabot.yml --- .github/dependabot.yml | 26 -------------------------- 1 file changed, 26 deletions(-) delete mode 100644 .github/dependabot.yml diff --git a/.github/dependabot.yml b/.github/dependabot.yml deleted file mode 100644 index edb72bff..00000000 --- a/.github/dependabot.yml +++ /dev/null @@ -1,26 +0,0 @@ ---- -version: 2 -updates: - - package-ecosystem: "github-actions" - directory: / - schedule: - interval: "weekly" - timezone: "America/Los_Angeles" - labels: - - "dependabot" - - "dependencies" - - "github-actions" - commit-message: - prefix: "chore(deps)" - - - package-ecosystem: "npm" # See documentation for possible values - directory: / - schedule: - interval: "weekly" - timezone: "America/Los_Angeles" - labels: - - "dependabot" - - "dependencies" - - "npm" - commit-message: - prefix: "chore(deps)"