From 327e6f5e519e9e4a553879befd167f5742a2b4f3 Mon Sep 17 00:00:00 2001 From: Naor Peled Date: Sat, 20 Apr 2024 14:35:56 +0300 Subject: [PATCH] ci: add release drafter (#545) --- .github/release-drafter.yml | 19 ++++++++++++ .../draft-or-update-next-release.yml | 20 +++++++++++++ .github/workflows/publish.yml | 29 +++++++++++++++++++ package.json | 1 - 4 files changed, 68 insertions(+), 1 deletion(-) create mode 100644 .github/release-drafter.yml create mode 100644 .github/workflows/draft-or-update-next-release.yml create mode 100644 .github/workflows/publish.yml diff --git a/.github/release-drafter.yml b/.github/release-drafter.yml new file mode 100644 index 0000000..131e1ca --- /dev/null +++ b/.github/release-drafter.yml @@ -0,0 +1,19 @@ +name-template: 'v$RESOLVED_VERSION 🌈' +tag-template: 'v$RESOLVED_VERSION' +version-resolver: + major: + labels: + - major + minor: + labels: + - minor + patch: + labels: + - patch + default: patch +change-template: '- $TITLE @$AUTHOR (#$NUMBER)' +change-title-escapes: '\<*_&' +template: | + ## Changes + + $CHANGES diff --git a/.github/workflows/draft-or-update-next-release.yml b/.github/workflows/draft-or-update-next-release.yml new file mode 100644 index 0000000..bb55892 --- /dev/null +++ b/.github/workflows/draft-or-update-next-release.yml @@ -0,0 +1,20 @@ +name: 📝 Draft or update next release +concurrency: draft_or_update_next_release + +on: + push: + branches: + - main + workflow_dispatch: + +jobs: + prepare-deployment: + name: 📝 Draft or update next release + runs-on: ubuntu-latest + timeout-minutes: 30 + steps: + - uses: actions/checkout@v1 + + - uses: release-drafter/release-drafter@v5 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml new file mode 100644 index 0000000..9cfdef7 --- /dev/null +++ b/.github/workflows/publish.yml @@ -0,0 +1,29 @@ +name: Release + +on: + # This job runs when a new release is published + release: + types: [published] + +jobs: + release: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - uses: actions/setup-node@v2 + with: + node-version: 16 + registry-url: https://registry.npmjs.org + - uses: actions/cache@v2 + with: + path: ~/.npm + key: ${{ runner.os }}-node-${{ hashFiles('**/package.json') }} + # Store the name of the release + # See https://stackoverflow.com/questions/58177786/get-the-current-pushed-tag-in-github-actions + - run: echo "RELEASE_VERSION=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV + - run: npm ci + - run: npm version $RELEASE_VERSION --no-git-tag-version + - run: npm run build + - run: npm publish --access public + env: + NODE_AUTH_TOKEN: ${{ secrets.BOWSER_NPM_PUBLISH_TOKEN }} diff --git a/package.json b/package.json index c719065..8411f81 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,5 @@ { "name": "bowser", - "version": "2.11.0", "description": "Lightweight browser detector", "keywords": [ "browser",