Rename variable #10
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 do a clean installation of node dependencies, cache/restore them, build the source code and run tests across different versions of node | |
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-nodejs | |
name: Node.js CI | |
on: | |
push: | |
branches: ['main'] | |
pull_request: | |
branches: ['main'] | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
os: [ubuntu-latest] | |
node-version: [18.x] | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: actions/cache@v3 | |
with: | |
path: 'node_modules' | |
key: ${{ runner.os }}-${{ matrix.node-version }}-modules-${{ hashFiles('yarn.lock') }} | |
- run: yarn install --frozen-lockfile | |
- run: yarn build | |
- name: Add artifact to github | |
uses: actions/upload-artifact@v2 | |
with: | |
name: artifact | |
path: dist | |
test: | |
needs: [build] | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
os: [ubuntu-latest, windows-latest, macos-latest] | |
node-version: [18.x] | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Use Node.js ${{ matrix.node-version }} | |
uses: actions/setup-node@v3 | |
with: | |
node-version: ${{ matrix.node-version }} | |
- uses: actions/cache@v3 | |
with: | |
path: 'node_modules' | |
key: ${{ runner.os }}-${{ matrix.node-version }}-modules-${{ hashFiles('yarn.lock') }} | |
- run: yarn install --frozen-lockfile | |
- run: yarn lint | |
- name: Download build | |
uses: actions/download-artifact@v2 | |
with: | |
name: artifact | |
path: dist | |
- run: yarn test | |
npm-publish: | |
needs: [build, test] | |
name: npm-publish | |
runs-on: ubuntu-latest | |
if: github.ref == 'refs/heads/main' | |
strategy: | |
matrix: | |
os: [ubuntu-latest] | |
node-version: [18.x] | |
steps: | |
- uses: actions/checkout@v2 | |
- uses: actions/setup-node@v3 | |
with: | |
node-version: ${{ matrix.node-version }} | |
- name: Download build | |
uses: actions/download-artifact@v2 | |
with: | |
name: artifact | |
path: dist | |
- uses: actions/cache@v3 | |
with: | |
path: 'node_modules' | |
key: ${{ runner.os }}-${{ matrix.node-version }}-modules-${{ hashFiles('yarn.lock') }} | |
- run: yarn install --frozen-lockfile | |
- run: yarn release:package && ls -lisha release | |
- name: Publish if version in package.json change | |
uses: springtype-org/github-action-npm-publish@master | |
with: | |
install_build_packages: false | |
project_build_dir: release | |
create_tag: true | |
auth_token: ${{ secrets.NPM_TOKEN }} | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |