Skip to content

Merge pull request #6 from h-sphere/feat/documentation #17

Merge pull request #6 from h-sphere/feat/documentation

Merge pull request #6 from h-sphere/feat/documentation #17

Workflow file for this run

name: Deploy NPM package
on:
push:
branches:
- main
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- name: Setup Node.js
uses: actions/setup-node@v2
with:
node-version: 21
- name: Get yarn cache
id: yarn-cache
run: echo "::set-output name=dir::$(yarn cache dir)"
- uses: actions/cache@v1
with:
path: ${{ steps.yarn-cache.outputs.dir }}
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-yarn-
- name: Install node_modules
run: yarn install --frozen-lockfile
- name: Compile
run: yarn compile
- name: Upload artifacts folder
uses: actions/upload-artifact@v3
with:
name: dist
path: dist/
publish:
runs-on: ubuntu-latest
needs: build
env:
NPM_TOKEN: ${{secrets.NPM_TOKEN}}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
steps:
- uses: actions/checkout@v1
- name: Download dist
uses: actions/download-artifact@v1
with:
name: dist
- name: Check if version has been updated
id: check
uses: EndBug/version-check@v2
- name: Set Token
run: npm config set //registry.npmjs.org/:_authToken=$NPM_TOKEN
- name: Publish
# if: steps.check.outputs.changed == 'true'
run: npm publish --access public
- name: Publish tag
# if: steps.check.outputs.changed == 'true'
run: gh release create `node -p require('package.json').version`