diff --git a/.github/workflows/npm-publish.yml b/.github/workflows/npm-publish.yml new file mode 100644 index 0000000..e7fcc75 --- /dev/null +++ b/.github/workflows/npm-publish.yml @@ -0,0 +1,21 @@ +name: Publish to NPM + +on: + workflow_dispatch: + release: + types: [created] + +jobs: + publish-npm: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-node@v4 + with: + node-version: 20 + registry-url: https://registry.npmjs.org/ + - run: yarn install + - run: yarn dev:build + - run: yarn publish + env: + NODE_AUTH_TOKEN: ${{secrets.npm_token}} diff --git a/CHANGELOG.md b/CHANGELOG.md index 6792659..d06a9a0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,9 @@ # Changelog +## v0.2.4 + +[compare changes](https://github.com/stackbuilders/nuxt-utm/compare/v0.2.3...v0.2.4) + ## v0.2.2 [compare changes](https://github.com/stackbuilders/nuxt-utm/compare/v0.1.5...v0.2.2) diff --git a/README.md b/README.md index 18e3ee6..a368ef9 100644 --- a/README.md +++ b/README.md @@ -140,6 +140,8 @@ yarn test:watch yarn release ``` +For detailed information about the release process, please refer to our [Release Documentation](/docs/RELEASING.md). + ## License diff --git a/docs/RELEASING.md b/docs/RELEASING.md new file mode 100644 index 0000000..59f9fb6 --- /dev/null +++ b/docs/RELEASING.md @@ -0,0 +1,92 @@ +# Release Process + +This document outlines the release process for the Nuxt UTM module. + +## Release Workflow + +We follow a two-step release process: + +1. **Manual Release Preparation (Local)**: + + - Version bump + - CHANGELOG update + - Tag creation + - Git commit + +2. **Automated NPM Publishing (GitHub Actions)**: + - Triggered by the newly created release/tag + - Builds and publishes the package to NPM + +## Manual Release Steps + +To create a new release: + +1. Ensure you have the latest changes from the main branch: + + ```bash + git checkout main + git pull origin main + ``` + +2. Make sure all tests pass: + + ```bash + yarn test + ``` + +3. Run the release script, which will: + + - Bump the version in package.json + - Update the CHANGELOG.md + - Create a git tag + - Commit changes + + ```bash + yarn release + ``` + +4. Push the changes including the new tag: + ```bash + # This will be done automatically by the release script + ``` + +## Automated NPM Publishing + +After the manual release process: + +1. GitHub Actions workflow [npm-publish.yml](../.github/workflows/npm-publish.yml) will be triggered automatically when: + + - A new GitHub release is created + - OR manually triggered via workflow_dispatch + +2. The workflow will: + - Check out the repository + - Set up Node.js + - Install dependencies + - Build the module + - Publish to NPM using the credentials stored in GitHub secrets + +## Version Numbering + +We follow [Semantic Versioning](https://semver.org/) for this project: + +- **MAJOR** version for incompatible API changes +- **MINOR** version for backwards-compatible functionality additions +- **PATCH** version for backwards-compatible bug fixes + +## Troubleshooting + +If the automated publishing fails: + +1. Check the GitHub Actions logs for errors +2. Ensure the `npm_token` secret is correctly set in the repository settings +3. Verify that the version in package.json hasn't already been published + +## Additional Notes + +- The release process uses [changelogen](https://github.com/unjs/changelogen) to generate CHANGELOG entries +- Always verify that the published package works correctly by installing it in a test project + +--- + +For questions or assistance with the release process, please contact the maintainers or email [community@stackbuilders.com](mailto:community@stackbuilders.com). diff --git a/package.json b/package.json index 5f35882..3c56351 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "nuxt-utm", - "version": "0.2.3", + "version": "0.2.4", "description": "A Nuxt 3 module for tracking UTM parameters.", "keywords": [ "nuxt", @@ -39,7 +39,8 @@ "dev": "nuxi dev playground", "dev:build": "nuxi build playground", "dev:prepare": "nuxt-module-build --stub && nuxt-module-build prepare && nuxi prepare playground", - "release": "npm run prepack && changelogen --release && npm publish && git push --follow-tags", + "release": "npm run prepack && changelogen --release && git push --follow-tags", + "publish": "npm run prepack && npm publish", "lint": "eslint .", "test": "vitest run", "test:watch": "vitest watch"