ci: action command #6
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: Test and publish | |
on: | |
push: | |
branches: [ master, beta ] | |
release: | |
types: [ created ] | |
jobs: | |
test: | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
# node-version: [19, 16, 14] | |
node-version: [19] | |
name: Node.js ${{ matrix.node-version }} test | |
steps: | |
- name: Git checkout | |
uses: actions/checkout@v3 | |
- name: Setup pnpm | |
uses: pnpm/action-setup@v2 | |
with: | |
version: latest | |
- name: Install Node.js ${{ matrix.node-version }} | |
uses: actions/setup-node@v3 | |
with: | |
node-version: ${{ matrix.node-version }} | |
cache: 'pnpm' | |
- name: Install dependencies | |
run: pnpm install --frozen-lockfile --strict-peer-dependencies | |
- run: pnpm config set link-workspace-packages false | |
- run: pnpm config list | |
- run: ls -la | |
- run: ls -la node_modules | |
- run: npx lsk info | |
- run: ls -la node_modules/lsk | |
# - run: ls -la .pnpm/[email protected]/node_modules/lsk | |
# - run: ls -la .pnpm/[email protected]/node_modules/lsk/bin | |
- run: pnpx lsk run build | |
- run: pnpm run build | |
- run: pnpm run test | |
publish: | |
needs: test | |
runs-on: ubuntu-latest | |
if: ${{ !contains(github.event.head_commit.message, 'chore(release)') }} | |
strategy: | |
matrix: | |
node-version: [19] | |
steps: | |
- name: Git checkout | |
uses: actions/checkout@v3 | |
- name: Setup pnpm | |
uses: pnpm/action-setup@v2 | |
with: | |
version: latest | |
- name: Install Node.js ${{ matrix.node-version }} | |
uses: actions/setup-node@v3 | |
with: | |
node-version: ${{ matrix.node-version }} | |
cache: 'pnpm' | |
- name: Install dependencies | |
run: pnpm install --frozen-lockfile --strict-peer-dependencies | |
- name: Set NODE_AUTH_TOKEN | |
run: echo "${NODE_AUTH_TOKEN}" && pnpm config set '//registry.npmjs.org/:_authToken' "${NODE_AUTH_TOKEN}" | |
env: | |
NODE_AUTH_TOKEN: ${{secrets.NODE_AUTH_TOKEN}} | |
- name: NPM release | |
run: pnpm release:ci && echo PACKAGE_VERSION=$(node -p "require('./package.json').version") >> $GITHUB_ENV | |
- name: Commit version and tag to git | |
uses: EndBug/add-and-commit@v9 | |
with: | |
add: 'package.json' | |
author_name: Igor Suvorov Bot | |
author_email: [email protected] | |
default_author: github_actor | |
message: 'chore(release): 🎉 v${{ env.PACKAGE_VERSION }}' | |
tag: 'v${{ env.PACKAGE_VERSION }} --force' |