Update README.md (#120) #126
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: Release | |
on: | |
push: | |
branches: | |
- main | |
- next | |
repository_dispatch: | |
types: | |
- semantic-release | |
jobs: | |
test: | |
name: Test | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: actions/setup-node@v3 | |
with: | |
node-version: 16 | |
cache: npm | |
- run: npm ci --prefer-offline | |
- name: Install Coverage Reporter | |
run: | | |
curl -L https://codeclimate.com/downloads/test-reporter/test-reporter-latest-linux-amd64 > ./cc-test-reporter | |
chmod +x ./cc-test-reporter | |
./cc-test-reporter before-build | |
- run: npm test | |
- name: Format Coverage | |
run: ./cc-test-reporter format-coverage -t lcov -o coverage/coverage.json coverage/lcov.info | |
- name: Upload Coverage | |
uses: actions/upload-artifact@v3 | |
with: | |
name: coverage | |
path: coverage | |
- name: Cache dependencies | |
uses: actions/cache@v3 | |
with: | |
path: ~/.npm | |
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }} | |
restore-keys: | | |
${{ runner.os }}-build-${{ env.cache-name }}- | |
${{ runner.os }}-build- | |
${{ runner.os }}- | |
release: | |
name: Release | |
needs: Test | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
persist-credentials: false | |
- run: npm ci --prefer-offline | |
- name: Semantic Release | |
uses: cycjimmy/semantic-release-action@v3 | |
id: semantic # Need an `id` for output variables | |
with: | |
extra_plugins: | | |
@semantic-release/changelog | |
@semantic-release/git | |
env: | |
GH_TOKEN: ${{ secrets.GH_TOKEN }} | |
NPM_TOKEN: ${{ secrets.NPM_TOKEN }} | |
upload-coverage: | |
name: Upload Coverage | |
runs-on: ubuntu-latest | |
needs: | |
- Test | |
- Release | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: actions/setup-node@v3 | |
with: | |
node-version: 12 | |
- name: Download coverage | |
uses: actions/download-artifact@v3 | |
with: | |
name: coverage | |
- name: Install Coverage Reporter | |
run: | | |
curl -L https://codeclimate.com/downloads/test-reporter/test-reporter-latest-linux-amd64 > ./cc-test-reporter | |
chmod +x ./cc-test-reporter | |
- name: Upload Coverage | |
run: ./cc-test-reporter upload-coverage -i coverage/coverage.json | |
env: | |
CC_TEST_REPORTER_ID: ${{ secrets.CC_TEST_REPORTER_ID }} | |
docs-deploy: | |
runs-on: ubuntu-latest | |
needs: Release | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: actions/setup-node@v3 | |
with: | |
node-version: 16 | |
- run: npm ci --prefer-offline | |
- run: npm run docs | |
- name: Deploy | |
uses: peaceiris/actions-gh-pages@v3 | |
with: | |
github_token: ${{ secrets.GITHUB_TOKEN }} | |
publish_dir: ./_site |