Skip to content
This repository has been archived by the owner on Dec 8, 2022. It is now read-only.

Commit

Permalink
Merge pull request #52 from MonsantoCo/feature/add-npm-publish-dev
Browse files Browse the repository at this point in the history
DevOps Feature: GH Action to Publish Dev Versions
  • Loading branch information
stazrad authored Apr 16, 2020
2 parents 48e8dac + fb0e75a commit 81de435
Show file tree
Hide file tree
Showing 4 changed files with 44 additions and 4 deletions.
14 changes: 14 additions & 0 deletions .github/tasks/next-dev-version.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
const version = require('../../package.json').version;
const semver = require('semver');

function nextVersion() {
const s = semver.parse(version);
if (!s) {
throw new Error(`Invalid version ${version}`);
}
return `${s.major}.${s.minor}.${s.patch}-dev.${Date.now()}`;
}

if (require.main === module) {
process.stdout.write(`${nextVersion()}\n`);
}
26 changes: 26 additions & 0 deletions .github/workflows/publish-dev.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
name: Publish-Dev

on:
push:
branches:
- master

jobs:
publish-npm-dev:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v1
with:
node-version: 12
registry-url: https://registry.npmjs.org/
- name: Install dependencies
run: npm ci
- name: Publish
run: |
VERSION=$(node .github/tasks/next-dev-version.js)
npm --no-git-tag-version version ${VERSION}
npm run build && npm publish --tag dev
env:
NODE_AUTH_TOKEN: ${{secrets.npm_token}}
SHIP: "true"
6 changes: 3 additions & 3 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
Expand Up @@ -101,7 +101,7 @@
"react": "~16.11.0",
"react-dom": "~16.11.0",
"runjs": "^4.4.2",
"semver": "^7.1.3",
"semver": "^7.3.2",
"styled-components": "~5.0.0"
},
"peerDependencies": {
Expand Down

0 comments on commit 81de435

Please sign in to comment.