Merge pull request #97 from u38502/master #112
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
on: | |
push: | |
branches: | |
- master | |
name: Build and Publish | |
jobs: | |
build: | |
if: "!contains(github.event.head_commit.message, 'no-ci')" | |
name: Build Library | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@master | |
- uses: actions/setup-node@v1 | |
with: | |
node-version: 16.18.1 | |
- uses: actions/cache@v1 | |
id: cache-modules | |
with: | |
path: node_modules | |
key: ${{ runner.OS }}-build-${{ hashFiles('package.json') }} | |
- run: yarn install --pure-lockfile | |
if: steps.cache-modules.outputs.cache-hit != 'true' | |
- run: yarn build | |
- run: yarn test | |
- run: yarn test:badges | |
- name: Upload esm build artifact | |
uses: actions/upload-artifact@v2 | |
with: | |
name: build-esm | |
path: esm | |
- name: Upload lib build artifact | |
uses: actions/upload-artifact@v2 | |
with: | |
name: build-lib | |
path: lib | |
deploy: | |
needs: build | |
name: Deploy Library | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@master | |
- uses: actions/setup-node@v1 | |
with: | |
node-version: 16.18.1 | |
- uses: actions/cache@v1 | |
id: cache-modules | |
with: | |
path: node_modules | |
key: ${{ runner.OS }}-build-${{ hashFiles('package.json') }} | |
- name: Download build-lib | |
uses: actions/download-artifact@v2 | |
with: | |
name: build-lib | |
path: lib | |
- name: Download build-esm | |
uses: actions/download-artifact@v2 | |
with: | |
name: build-esm | |
path: esm | |
- name: Deploy to NPM! 🚀 | |
uses: benwinding/merge-release@master | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
NPM_AUTH_TOKEN: ${{ secrets.NPM_AUTH_TOKEN }} | |
demo: | |
needs: build | |
name: Deploy Demo | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@master | |
- uses: actions/setup-node@v1 | |
with: | |
node-version: 16.18.1 | |
- uses: actions/cache@v1 | |
id: cache-modules | |
with: | |
path: node_modules | |
key: ${{ runner.OS }}-build-${{ hashFiles('package.json') }} | |
- run: yarn build-for-demo | |
- run: yarn build | |
working-directory: ./demo | |
- name: Deploy 🚀 | |
if: github.ref == 'refs/heads/master' | |
uses: JamesIves/github-pages-deploy-action@releases/v3 | |
with: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
BRANCH: gh-pages # The branch the action should deploy to. | |
FOLDER: demo/build # The folder the action should deploy. |