From 61bfef60e6f15665b9603a8b8ed9a250ec47f4bd Mon Sep 17 00:00:00 2001 From: Berrie Nachtweh Date: Thu, 15 Jan 2026 21:46:42 +0100 Subject: [PATCH] ci(release): add npm publish command --- .github/workflows/release.yml | 50 ++++++++++++++++++++++------------- CHANGELOG.md | 18 ------------- 2 files changed, 32 insertions(+), 36 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 4409b6c..5c8bcd1 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -7,28 +7,33 @@ on: required: true type: choice description: Which version should be published? - options: - - patch - - minor - - major - - prepatch - - preminor - - premajor - - prerelease + options: [patch, minor, major, prepatch, preminor, premajor, prerelease] tag: required: true type: choice description: Which npm tag should this be published to? - options: - - latest - - next + options: [latest, next] jobs: create-release: runs-on: ubuntu-latest + environment: npm-publish + permissions: + contents: write + id-token: write steps: + - name: Generate Token + uses: actions/create-github-app-token@v1 + id: app-token + with: + app-id: ${{ secrets.BOT_APP_ID }} + private-key: ${{ secrets.BOT_PRIVATE_KEY }} + - name: Checkout uses: actions/checkout@v4 + with: + token: ${{ steps.app-token.outputs.token }} + fetch-depth: 0 - name: Configure Git Identity run: | @@ -38,12 +43,21 @@ jobs: - name: Setup uses: ./.github/actions/setup - - name: Install changelogen - run: pnpm add -g changelogen + - name: Ensure Latest NPM + run: npm install -g npm@latest + + - name: Bump Version and Push + env: + GITHUB_TOKEN: ${{ steps.app-token.outputs.token }} + run: | + PRERELEASE_FLAG="" + if [[ "${{ github.event.inputs.version }}" == pre* ]]; then PRERELEASE_FLAG="--prerelease"; fi + pnpm dlx changelogen@latest --bump --release $PRERELEASE_FLAG --${{ github.event.inputs.version }} --push + + - name: Build + run: pnpm run build - - name: Create new version - id: version + - name: Publish to NPM run: | - pnpm config set //registry.npmjs.org/:_authToken "" - pnpm dlx changelogen --bump --release --${{ github.event.inputs.version }} --publishTag ${{ github.event.inputs.tag }} --push --publish - pnpm dlx changelogen gh release + npm config set //registry.npmjs.org/:_authToken "" + npm publish --provenance --access public --tag ${{ github.event.inputs.tag }} diff --git a/CHANGELOG.md b/CHANGELOG.md index 0c826af..825c32f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,19 +1 @@ # Changelog - -## v0.0.3-0 - - -### 🤖 CI - -- **release:** Trigger new create release workflow and bump version ([#15](https://github.com/ambitiondev/dynamic-url/pull/15)) - -### ❤️ Contributors - -- Berrie Nachtweh ([@bnachtweh](https://github.com/bnachtweh)) - -## [0.0.2](https://github.com/ambitiondev/dynamic-url/compare/dynamic-url-v0.0.1...dynamic-url-v0.0.2) (2026-01-15) - - -### Bug Fixes - -* **release:** make sure the release gets done following v4 ([#9](https://github.com/ambitiondev/dynamic-url/issues/9)) ([9b156a2](https://github.com/ambitiondev/dynamic-url/commit/9b156a2d40399e46663f0edf6c5ab6526bf0482d))