feat: deps #73
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
# This workflow will run tests using node and then publish a package to GitHub Packages when a release is created | |
# For more information see: https://help.github.com/actions/language-and-framework-guides/publishing-nodejs-packages | |
name: publish | |
on: | |
pull_request: | |
types: [closed] | |
branches: | |
- develop | |
- master | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
- uses: actions/setup-node@v1 | |
with: | |
node-version: 14 | |
- name: Restore node_modules | |
uses: actions/cache@v2 | |
with: | |
path: '**/node_modules' | |
key: modules-${{ hashFiles('**/yarn.lock') }} | |
restore-keys: | | |
modules-${{ hashFiles('**/yarn.lock') }} | |
modules- | |
- run: yarn | |
- run: yarn test | |
publish-npm: | |
needs: build | |
runs-on: ubuntu-latest | |
if: github.event.pull_request.merged == true | |
env: | |
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} | |
NPM_TOKEN: ${{ secrets.NPM_TOKEN }} | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
steps: | |
- uses: actions/checkout@v2 | |
- uses: actions/setup-node@v1 | |
with: | |
node-version: 14 | |
registry-url: https://registry.npmjs.org/ | |
- run: | | |
git config --local user.email "[email protected]" | |
git config --local user.name "fupengl" | |
git remote set-url origin https://x-access-token:${GITHUB_TOKEN}@github.com/$GITHUB_REPOSITORY | |
- name: Restore node_modules | |
uses: actions/cache@v2 | |
with: | |
path: '**/node_modules' | |
key: modules-${{ hashFiles('**/yarn.lock') }} | |
restore-keys: | | |
modules-${{ hashFiles('**/yarn.lock') }} | |
modules- | |
- run: yarn | |
- name: Authenticate with Registry | |
run: | | |
yarn logout | |
echo "registry=https://registry.npmjs.org/" >> .npmrc | |
echo "//registry.npmjs.org/:_authToken=$NPM_TOKEN" >> .npmrc | |
npm whoami | |
- run: | | |
if [ ${{ github.base_ref }} = develop ]; then | |
yarn version:beta | |
else | |
yarn version:release | |
fi | |
yarn release:pkg --create-release github |