This repository has been archived by the owner on Dec 8, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 19
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #52 from MonsantoCo/feature/add-npm-publish-dev
DevOps Feature: GH Action to Publish Dev Versions
- Loading branch information
Showing
4 changed files
with
44 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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`); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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" |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters