Merge pull request #76 from shiftcode/#254-integrate-libs #410
This file contains hidden or 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
| # secrets.GITHUB_TOKEN is provided to each job by default, lifetime: 60minutes. | |
| # See https://help.github.com/en/actions/automating-your-workflow-with-github-actions/authenticating-with-the-github_token | |
| name: Lint, Test, Build and optionally Publish | |
| on: | |
| # push only for branches (ignore tags) | |
| push: | |
| branches: | |
| - 'main' | |
| tags-ignore: | |
| - '**' | |
| # pull request only for branches (ignore tags) | |
| pull_request: | |
| branches: | |
| - '**' | |
| tags-ignore: | |
| - '**' | |
| jobs: | |
| test: | |
| runs-on: ubuntu-latest | |
| strategy: | |
| matrix: | |
| # Test with Node.js 24 and v25 | |
| node: | |
| - 24 | |
| - 25 | |
| name: Node.js v${{ matrix.node }} | |
| steps: | |
| # checkout branch | |
| - name: Checkout | |
| uses: actions/checkout@93cb6efe18208431cddfb8368fd83d5badbf9bfd #v5.0.1 | |
| # setup node and dependency cache | |
| - name: Setup Node and NPM Cache | |
| uses: actions/setup-node@a0853c24544627f65ddf259abe73b1d18a591444 # v5.0.0 | |
| with: | |
| node-version: ${{ matrix.node }} | |
| cache: 'npm' | |
| # install dependencies | |
| - name: Install | |
| run: HUSKY=0 npm ci | |
| # test | |
| - name: Test | |
| run: npm run test:ci | |
| build: | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: write | |
| packages: write | |
| needs: test | |
| steps: | |
| # checkout branch | |
| - name: Checkout | |
| uses: actions/checkout@93cb6efe18208431cddfb8368fd83d5badbf9bfd #v5.0.1 | |
| with: | |
| # 0 indicates all history, because publish requires tag information | |
| fetch-depth: 0 | |
| # setup node and dependency cache | |
| - name: Setup Node and NPM Cache | |
| uses: actions/setup-node@a0853c24544627f65ddf259abe73b1d18a591444 # v5.0.0 | |
| with: | |
| node-version-file: .nvmrc | |
| cache: 'npm' | |
| # install dependencies | |
| - name: Install | |
| run: HUSKY=0 npm ci | |
| # build lint plugins before linting | |
| - name: Build lint plugins | |
| run: npm run build:lint:ci | |
| # check formatting | |
| - name: Check Formatting | |
| run: npm run format:ci | |
| # lint | |
| - name: Lint | |
| run: npm run lint:ci | |
| # build | |
| - name: Build | |
| run: npm run build:ci | |
| # publish | |
| - name: Publish | |
| run: | | |
| npm config set //npm.pkg.github.com/:_authToken=${{ secrets.GITHUB_TOKEN }} | |
| git config user.email "actions@github.com" | |
| git config user.name "Github Actions" | |
| npm run publish-libs | |
| env: | |
| GITHUB_CONTEXT: ${{ toJson(github) }} |