Upgrade GitHub Actions #21
Workflow file for this run
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 | |
jobs: | |
test_and_publish: | |
name: Test and publish | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-node@v4 | |
with: | |
node-version: '18' | |
registry-url: https://registry.npmjs.org/ | |
- name: Install dependencies | |
run: yarn | |
- name: Run tests | |
run: yarn test | |
- name: Check code style | |
run: yarn check-prettier | |
- name: Create test report | |
run: yarn coverage | |
- name: Update code coverage | |
uses: codecov/codecov-action@v4 | |
with: | |
files: ./coverage.lcov | |
token: ${{ secrets.CODECOV_TOKEN }} | |
- name: Publish on npm | |
if: startsWith(github.ref, 'refs/tags/') | |
run: npm publish | |
env: | |
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} | |
- name: Add card file to release | |
if: startsWith(github.ref, 'refs/tags/') | |
uses: svenstaro/upload-release-action@v2 | |
with: | |
repo_token: ${{ secrets.GITHUB_TOKEN }} | |
file: card.js | |
asset_name: card.js | |
tag: ${{ github.ref }} | |
- name: Purge jsDelivr cache | |
if: startsWith(github.ref, 'refs/tags/') | |
run: curl https://purge.jsdelivr.net/npm/rgb-light-card |