fix #288
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: 'CI: µ' | |
on: [ push ] | |
jobs: | |
lint-changelog: | |
name: Lint changelog file | |
runs-on: ubuntu-latest | |
steps: | |
- name: Check out code | |
uses: actions/checkout@v4 | |
- name: Lint changelog file | |
uses: avto-dev/markdown-lint@v1 | |
with: | |
rules: './.github/workflows/lint/rules/changelog.cjs' | |
config: '/lint/config/changelog.yml' | |
args: './CHANGELOG.md' | |
lint-code: | |
runs-on: ubuntu-latest | |
name: testing on Node | |
strategy: | |
matrix: | |
node-version: [ 20.x ] | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Use Node.js ${{ matrix.node-version }} | |
uses: actions/setup-node@v4 | |
with: | |
node-version: ${{ matrix.node-version }} | |
- name: Get npm cache directory | |
id: npm-cache | |
run: | | |
echo "dir=$(npm config get cache)" >> $GITHUB_OUTPUT | |
- uses: actions/cache@v4 | |
with: | |
path: ${{ steps.npm-cache.outputs.dir }} | |
key: ${{ runner.os }}-node-${{ hashFiles('**/package.json') }} | |
restore-keys: | | |
${{ runner.os }}-node- | |
- run: yarn install | |
- run: yarn lint | |
env: | |
CI: true | |
testing-on-node: | |
runs-on: ubuntu-latest | |
name: testing on Node | |
needs: [ lint-changelog, lint-code ] | |
strategy: | |
matrix: | |
node-version: [ 20.x,21.x,22.x ] | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Use Node.js ${{ matrix.node-version }} | |
uses: actions/setup-node@v4 | |
with: | |
node-version: ${{ matrix.node-version }} | |
- name: Get npm cache directory | |
id: npm-cache | |
run: | | |
echo "dir=$(npm config get cache)" >> $GITHUB_OUTPUT | |
- uses: actions/cache@v4 | |
with: | |
path: ${{ steps.npm-cache.outputs.dir }} | |
key: ${{ runner.os }}-node-${{ hashFiles('**/package.json') }} | |
restore-keys: | | |
${{ runner.os }}-node- | |
- run: yarn install | |
- run: yarn test | |
env: | |
CI: true | |
npm-publish: | |
runs-on: ubuntu-latest | |
needs: [ lint-changelog, testing-on-node ] | |
if: ${{ startsWith(github.ref, 'refs/tags/v') }} | |
steps: | |
- uses: actions/checkout@v4 | |
# Setup .npmrc file to publish to npm | |
- uses: actions/setup-node@v4 | |
with: | |
node-version: '20.x' | |
registry-url: 'https://registry.npmjs.org' | |
- run: npm install | |
# Publish to npm | |
- run: npm publish --access public | |
env: | |
NODE_AUTH_TOKEN: ${{ secrets.NPM_AUTH_TOKEN }} | |
# | |
# npm-publish-fake: | |
# name: npm-publish | |
# needs: [lint-changelog, testing-on-node] | |
# runs-on: ubuntu-latest | |
# steps: | |
# - uses: actions/checkout@v2 | |
# - name: Publish if version has been updated | |
# uses: pascalgn/npm-publish-action@1.3.6 | |
# with: # All of theses inputs are optional | |
# tag_name: "v%s" | |
# tag_message: "v%s" | |
# commit_pattern: "^Release (\\S+)" | |
# workspace: "." | |
# publish_command: "yarn" | |
# publish_args: "--non-interactive" | |
# env: # More info about the environment variables in the README | |
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Leave this as is, it's automatically generated | |
# NPM_AUTH_TOKEN: ${{ secrets.NPM_AUTH_TOKEN }} # You need to set this in your repo settings |