Update package.json #7
Workflow file for this run
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
name: Build | |
on: | |
push: | |
jobs: | |
check_eslint: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Install modules | |
run: | | |
sudo npm install -g eslint@8 | |
- run: eslint index.js --ext .js,.jsx,.ts,.tsx | |
test: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@master | |
- name: Set up Node.js | |
uses: actions/setup-node@master | |
with: | |
node-version: 17 | |
- run: | | |
npm install | |
- run: | | |
npm run-script test | |
npm: | |
name: npm-publish | |
if: "github.event_name == 'push'" | |
runs-on: ubuntu-latest | |
needs: [check_eslint,test] | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@master | |
- name: Set up Node.js | |
uses: actions/setup-node@master | |
with: | |
node-version: 16 | |
registry-url: 'https://registry.npmjs.org' | |
- name: Install modules | |
run: | | |
npm install | |
- name: Test | |
run: npm test | |
- run: | | |
VERSION=$(echo "${{ github.ref }}" | sed -e 's,.*/\(.*\),\1,' | sed -e 's/^v//') | |
jq '.version="'"$VERSION"'"' package.json > /tmp/a | |
mv /tmp/a package.json | |
if: "startsWith(github.ref, 'refs/tags/v')" | |
- run: | | |
# npm login --scope=@halleyassist --registry=https://registry.npmjs.org/ | |
npm whoami | |
env: | |
NODE_AUTH_TOKEN: ${{ secrets.NPM_AUTH_TOKEN }} | |
- run: | | |
npm publish | |
env: | |
NODE_AUTH_TOKEN: ${{ secrets.NPM_AUTH_TOKEN }} | |
if: "startsWith(github.ref, 'refs/tags/v')" | |
- uses: actions/setup-node@v2 | |
with: | |
node-version: 16 | |
registry-url: https://npm.pkg.github.com/ | |
if: "startsWith(github.ref, 'refs/tags/v')" | |
- run: | | |
npm publish | |
env: | |
NODE_AUTH_TOKEN: ${{secrets.GITHUB_TOKEN}} | |
if: "startsWith(github.ref, 'refs/tags/v')" |