Skip to content

Commit

Permalink
workflow(integration): publish latest and next npm packages
Browse files Browse the repository at this point in the history
  • Loading branch information
mgermerie committed Feb 1, 2023
1 parent 470e306 commit f8996b3
Show file tree
Hide file tree
Showing 4 changed files with 38 additions and 5 deletions.
18 changes: 15 additions & 3 deletions .github/workflows/integration.yml
Original file line number Diff line number Diff line change
Expand Up @@ -77,24 +77,36 @@ jobs:
# Publish NPM package
# TODO: publish another npm package matching master branch
publish:
name: Publish NPM package
if: ${{ github.ref == 'refs/heads/master' && startsWith( github.event.head_commit.message, 'release v' ) }}
if: ${{ github.ref == 'refs/heads/master' }}
needs: tests
runs-on: ubuntu-latest
steps:

- uses: actions/checkout@v2

# Configure git user for later command induced commits
- uses: fregante/setup-git-user@v1

- uses: actions/setup-node@v1
with:
node-version: 15
registry-url: https://registry.npmjs.org/

- run: npm ci
- run: npm run prepare
- run: npm publish --access public

- name: publish itowns@latest npm package
if: ${{ startsWith(github.event.head_commit.message, 'release v' ) }}
run: npm run publish-latest
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}

- name: publish itowns@next npm package
run: |
npm run publish-next
git push
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}

Expand Down
17 changes: 16 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ In your project:
npm install --save itowns
```

This package contains the ES5-compatible sources of iTowns.
This package contains the ES5-compatible sources of iTowns, up to date with the latest release.

If you're using a module bundler (like wepback), you can directly write
`require('itowns')` in your code.
Expand All @@ -78,6 +78,21 @@ See our [release page](https://github.com/iTowns/itowns/releases). Note that
there isn't a lot of support for older version of iTowns, we highly recommand to
use the last release everytime.

### Try modifications before they are released

If you want to try some features or bug fixes that are planned for the next release, we provide
a @next version of itowns. You can install it as such :

```bash
npm install --save itowns@next
```

To switch back to the version to date with the latest release, you need to run :

```bash
npm install --save itowns@latest
```

## Contributing

If you are interested in contributing to iTowns, please read the [CONTRIBUTING
Expand Down
4 changes: 4 additions & 0 deletions config/conventionalChangelog/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,10 @@ var writerOpts = {
discard = false;
});

if (commit.header && commit.header.includes('-next.')) {
return;
}

if (['feat', 'features', 'feature'].includes(commit.type)) {
commit.type = 'Features';
} else if (commit.type === 'fix') {
Expand Down
4 changes: 3 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,9 @@
"prepare": "cross-env NO_UPDATE_NOTIFIER=true node ./config/prepare.mjs && node ./config/replace.config.mjs",
"watch": "cross-env BABEL_DISABLE_CACHE=1 babel --watch src --out-dir lib",
"changelog": "conventional-changelog -n ./config/conventionalChangelog/config.js -i changelog.md -s",
"bump": "if [ -z $npm_config_level ]; then grunt bump:minor; else grunt bump:$npm_config_level; fi && npm run changelog && git add -A && git commit --amend --no-edit"
"bump": "if [ -z $npm_config_level ]; then grunt bump:minor; else grunt bump:$npm_config_level; fi && npm run changelog && git add -A && git commit --amend --no-edit",
"publish-next": "npm version prerelease --preid next && npm publish --access public --tag=next",
"publish-latest": "npm publish --access public --tag=latest"
},
"nyc": {
"exclude": [
Expand Down

0 comments on commit f8996b3

Please sign in to comment.