Skip to content

Commit

Permalink
Merge pull request #4 from frontegg/add_push_to_npm
Browse files Browse the repository at this point in the history
Add push to npm
  • Loading branch information
noa-frontegg authored Jun 13, 2023
2 parents d8d95af + 7f36dd6 commit afe7da1
Show file tree
Hide file tree
Showing 3 changed files with 80 additions and 2 deletions.
71 changes: 71 additions & 0 deletions .github/workflows/publish.yml
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 }}
9 changes: 9 additions & 0 deletions .npmignore
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
2 changes: 0 additions & 2 deletions lib/Client.js
Original file line number Diff line number Diff line change
Expand Up @@ -81,8 +81,6 @@ module.exports = prototypal({
options.body = JSON.stringify(options.body);
}

const t = '';

return this.getter.got(uri, options).then(res => res.body);
},
});

0 comments on commit afe7da1

Please sign in to comment.