fix(main): fixes main refer to module (#223) #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 Publish | |
on: | |
push: | |
branches: | |
- main | |
release: | |
types: [created] | |
env: | |
GIT_USER: 'GitHub Actions' | |
GIT_EMAIL: 'github-actions[bot]@users.noreply.github.com' | |
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
- uses: actions/setup-node@v1 | |
with: | |
node-version: 18 | |
- name: Install Yarn | |
run: npm i -g yarn | |
- name: Install npm dependencies | |
run: yarn | |
- name: Run linter | |
run: yarn lint | |
- name: Run unit tests | |
run: yarn test | |
- name: Build package | |
run: yarn build | |
- name: Report coverage | |
run: yarn codecov | |
- name: Upload bundle artifact | |
uses: actions/upload-artifact@v2 | |
with: | |
name: dist | |
path: dist | |
- name: Build documentation | |
run: yarn docs:build | |
- name: Upload documentation artifact | |
uses: actions/upload-artifact@v2 | |
with: | |
name: docs | |
path: build | |
release: | |
needs: build | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
- uses: TriPSs/conventional-changelog-action@v3 | |
with: | |
github-token: ${{ secrets.GH_TOKEN }} | |
git-user-name: ${{ env.GIT_USER }} | |
git-user-email: ${{ env.GIT_EMAIL }} | |
tag-prefix: 'v' | |
release-count: '0' | |
skip-on-empty: false | |
deploy: | |
needs: build | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
with: | |
persist-credentials: false | |
- name: Pull latest | |
run: git pull origin main | |
- name: Download bundle artifact | |
uses: actions/download-artifact@v2 | |
with: | |
name: docs | |
path: build | |
- name: Create CNAME Record | |
run: echo "datebook.dev" > build/docs/CNAME | |
- name: Deploy docs to GitHub Pages | |
uses: JamesIves/github-pages-deploy-action@3.7.1 | |
with: | |
GITHUB_TOKEN: ${{ secrets.GH_TOKEN }} | |
GIT_CONFIG_NAME: ${{ env.GIT_USER }} | |
GIT_CONFIG_EMAIL: ${{ env.GIT_EMAIL }} | |
BRANCH: gh-pages | |
FOLDER: build/docs | |
CLEAN: true | |
publish-npm: | |
needs: release | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Pull latest | |
run: git pull origin main | |
- name: Download bundle artifact | |
uses: actions/download-artifact@v2 | |
with: | |
name: dist | |
path: dist | |
- uses: actions/setup-node@v1 | |
with: | |
node-version: 14 | |
registry-url: https://registry.npmjs.org/ | |
- run: npm publish | |
env: | |
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} |