forked from cloudflare/node-cloudflare
-
Notifications
You must be signed in to change notification settings - Fork 0
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 #4 from frontegg/add_push_to_npm
Add push to npm
- Loading branch information
Showing
3 changed files
with
80 additions
and
2 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,71 @@ | ||
name: Publish to NPM | ||
on: | ||
# When Release Pull Request is merged | ||
push: | ||
branches: | ||
- master | ||
|
||
env: | ||
CI: true | ||
jobs: | ||
publish: | ||
name: Publish | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v3 | ||
with: | ||
fetch-depth: "0" | ||
- name: Use Node.js (.nvmrc) | ||
uses: actions/setup-node@v3 | ||
with: | ||
cache: npm | ||
node-version: 18 | ||
- name: Set Current Version | ||
id: set_current_version | ||
if: startsWith(github.event.pull_request.title, 'v') | ||
shell: bash -ex {0} | ||
run: | | ||
CURRENT_VERSION=$(node -p 'require("./package.json").version') | ||
echo "::set-output name=CURRENT_VERSION::${CURRENT_VERSION}" | ||
- name: Create Git Tag | ||
uses: azu/action-package-version-to-git-tag@v1 | ||
with: | ||
version: ${{ steps.set_current_version.outputs.CURRENT_VERSION }} | ||
github_token: ${{ secrets.GITHUB_TOKEN }} | ||
github_repo: ${{ github.repository }} | ||
git_commit_sha: ${{ github.sha }} | ||
git_tag_prefix: "v" | ||
- name: Create Release | ||
id: create_release | ||
uses: actions/create-release@v1 | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
with: | ||
tag_name: v${{ steps.set_current_version.outputs.CURRENT_VERSION }} | ||
release_name: ${{ github.event.pull_request.title }} | ||
body: | | ||
${{ github.event.pull_request.body }} | ||
draft: false | ||
prerelease: false | ||
- name: Authenticate with Registry | ||
run: | | ||
yarn logout | ||
echo "init-author-name=Frontegg LTD" > .npmrc | ||
echo "[email protected]" >> .npmrc | ||
echo "init-author-url=https://frontegg.com" >> .npmrc | ||
echo "init-license=MIT" >> .npmrc | ||
echo "always-auth=true" >> .npmrc | ||
echo "registry=https://registry.npmjs.org" >> .npmrc | ||
echo "_authToken=$NPM_TOKEN" >> .npmrc | ||
echo "@frontegg:registry=https://registry.npmjs.org" >> .npmrc | ||
echo "//registry.npmjs.org/:_authToken=$NPM_TOKEN" >> .npmrc | ||
npm whoami | ||
env: | ||
NPM_TOKEN: ${{ secrets.NPM_PUBLISH_TOKEN }} | ||
- name: Publish | ||
run: | | ||
npm publish --tag latest | ||
env: | ||
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
NODE_AUTH_TOKEN: ${{ secrets.NPM_PUBLISH_TOKEN }} |
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,9 @@ | ||
.github | ||
.nyc_output | ||
coverage | ||
node_modules | ||
test | ||
.eslintrc.yml | ||
.gitignore | ||
.prettierrc.yaml | ||
package-lock.json |
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