Skip to content

Commit 735d81a

Browse files
authored
Merge pull request #330 from tschaub/publish-dev
New workflow to publish dev tagged releases
2 parents e1ff57f + 9eec537 commit 735d81a

File tree

3 files changed

+42
-2
lines changed

3 files changed

+42
-2
lines changed

.github/workflows/publish.yml

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
name: Publish
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
8+
jobs:
9+
publish-npm:
10+
runs-on: ubuntu-latest
11+
steps:
12+
- uses: actions/checkout@v2
13+
- uses: actions/setup-node@v2
14+
with:
15+
node-version: '16'
16+
registry-url: 'https://registry.npmjs.org'
17+
- name: Install dependencies
18+
run: npm ci
19+
- name: Publish
20+
run: |
21+
VERSION=$(node tasks/next-dev-version.js)
22+
npm --no-git-tag-version version ${VERSION}
23+
npm publish --tag dev
24+
env:
25+
NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}}

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "mock-fs",
33
"description": "A configurable mock file system. You know, for testing.",
4-
"version": "5.0.0-beta.1",
4+
"version": "4.14.0",
55
"main": "lib/index.js",
66
"homepage": "https://github.com/tschaub/mock-fs",
77
"author": {
@@ -28,7 +28,7 @@
2828
"lib"
2929
],
3030
"scripts": {
31-
"lint": "eslint benchmarks lib test",
31+
"lint": "eslint benchmarks lib test tasks",
3232
"pretest": "npm run lint",
3333
"test": "mocha --recursive test"
3434
},

tasks/next-dev-version.js

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
const semver = require('semver');
2+
const pkg = require('../package.json');
3+
4+
function nextVersion() {
5+
const version = pkg.version;
6+
const s = semver.parse(version);
7+
if (!s) {
8+
throw new Error(`Invalid version ${version}`);
9+
}
10+
return `${s.major}.${s.minor}.${s.patch}-dev.${Date.now()}`;
11+
}
12+
13+
if (require.main === module) {
14+
process.stdout.write(`${nextVersion()}\n`);
15+
}

0 commit comments

Comments
 (0)