Skip to content

Commit

Permalink
Merge pull request #42 from camptocamp/publish-npm-dev-version
Browse files Browse the repository at this point in the history
Auto-publish @dev version on NPM
  • Loading branch information
jahow authored May 6, 2024
2 parents f7705a0 + 5c569b3 commit 2f73cdd
Show file tree
Hide file tree
Showing 4 changed files with 46 additions and 4 deletions.
34 changes: 34 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
name: Publish NPM package @dev version

# This workflow runs whenever a commit is pushed on main
on:
push:
branches:
- main

jobs:
publish-npm-package:
name: Publish NPM package
runs-on: ubuntu-latest

steps:
- name: Checkout
uses: actions/checkout@v3

- name: Install Node & NPM
uses: actions/setup-node@v3
with:
node-version: '20'
cache: 'npm'

- name: Install dependencies
run: npm ci

# New version will be <npm version>.<commit hash>, e.g. 1.1.1-dev.0a4c598
- name: Adjust package version according to branch & commit
run: npm version $(node --print 'require("./package.json").version').$(git rev-parse --short HEAD) --no-git-tag-version --allow-same-version

- name: Publish NPM package with @dev tag
run: npm publish --tag dev
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
10 changes: 9 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# ogc-client
# ogc-client [![Latest version on NPM](https://img.shields.io/npm/v/%40camptocamp%2Fogc-client)](https://www.npmjs.com/package/@camptocamp/ogc-client) [![Latest @dev version on NPM](https://img.shields.io/npm/v/%40camptocamp%2Fogc-client/dev)](https://www.npmjs.com/package/@camptocamp/ogc-client?activeTab=versions)

> A Typescript library for interacting with [OGC-compliant services](https://www.ogc.org/docs/is)
Expand Down Expand Up @@ -48,6 +48,14 @@ enableFallbackWithoutWorker();

All processing will be done on the main thread after this call, including HTTP requests.

### Use the latest development version

[The `@camptocamp/ogc-client` NPM package](https://www.npmjs.com/package/@camptocamp/ogc-client) is updated on every commit on the `main` branch under the `@dev` tag. To use it:

```bash
$ npm install --save @camptocamp/ogc-client@dev
```

### Application

A provided application containing the documentation and demo is located in the `app` folder.
Expand Down
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@camptocamp/ogc-client",
"version": "1.1.0",
"version": "1.1.1-dev",
"description": "A pure JS library for interacting with geospatial services.",
"main": "./dist/dist-node.js",
"browser": "./dist/index.js",
Expand Down

0 comments on commit 2f73cdd

Please sign in to comment.