diff --git a/.github/release-drafter.yml b/.github/release-drafter.yml new file mode 100644 index 000000000..f6cee27be --- /dev/null +++ b/.github/release-drafter.yml @@ -0,0 +1,70 @@ +--- +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).*/i' + - label: 'breaking' + title: + - '/^(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 000000000..454586d06 --- /dev/null +++ b/.github/workflows/pr-lint.yml @@ -0,0 +1,44 @@ +## Reference: https://github.com/amannn/action-semantic-pull-request +--- +name: "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 000000000..8280f7b95 --- /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 }}