Update README.md #79
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 and release | |
on: | |
push: | |
branches: | |
- master | |
tags: | |
- "v*" | |
jobs: | |
build-test-and-publish: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Setup Node.js environment | |
uses: actions/setup-node@v2 | |
with: | |
node-version: 16.x | |
registry-url: https://registry.npmjs.org/ | |
- name: Install cli package | |
run: npm install | |
working-directory: packages/cli | |
- name: Build cli package | |
run: npm run build | |
working-directory: packages/cli | |
- name: Install root | |
run: npm install | |
- name: Test | |
run: npm run test | |
# Conditionally run if the build is triggered by a tagged push | |
- name: Publish to npm | |
if: startsWith(github.ref, 'refs/tags/v') | |
run: npm publish --access=public | |
working-directory: packages/cli | |
env: | |
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} | |
- name: Create Release | |
if: startsWith(github.ref, 'refs/tags/v') | |
id: create_release | |
uses: actions/create-release@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # This token is provided by Actions, you do not need to create your own token | |
with: | |
tag_name: ${{ github.ref }} | |
release_name: ${{ github.ref }} | |
draft: true | |
prerelease: false |