v2.3.0 #51
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
name: Publish CI | |
on: | |
release: | |
types: [published] | |
jobs: | |
publish-to-npm: | |
runs-on: ubuntu-22.04 | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Setup pnpm | |
uses: pnpm/action-setup@v4 | |
- name: Use Node.js 18.x | |
uses: actions/setup-node@v4 | |
with: | |
node-version: 18.x | |
cache: 'pnpm' | |
- name: Install dependencies | |
run: pnpm install --frozen-lockfile | |
- name: Build package | |
run: pnpm build | |
- name: Run tests | |
run: pnpm test | |
env: | |
CI: true | |
- name: Extract version from release | |
id: version | |
uses: olegtarasov/get-tag@v2.1 | |
with: | |
tagRegex: 'v(.*)' | |
- name: Set version from release | |
uses: reedyuk/npm-version@1.1.1 | |
with: | |
version: ${{ steps.version.outputs.tag }} | |
git-tag-version: 'false' | |
package: 'dist/' | |
- name: Create NPM config | |
working-directory: './dist/' | |
run: npm config set //registry.npmjs.org/:_authToken $NPM_TOKEN | |
env: | |
NPM_TOKEN: ${{ secrets.NPM_TOKEN }} | |
- name: Check for NEXT tag | |
id: next | |
uses: actions-ecosystem/action-regex-match@v2 | |
with: | |
text: ${{ steps.version.outputs.tag }} | |
regex: '-next' | |
- name: Check for RC tag | |
id: rc | |
uses: actions-ecosystem/action-regex-match@v2 | |
with: | |
text: ${{ steps.version.outputs.tag }} | |
regex: '-rc' | |
- name: Publish patronum@${{ steps.version.outputs.tag }} with NEXT tag | |
if: ${{ steps.next.outputs.match != '' }} | |
working-directory: './dist/' | |
run: npm publish --tag next | |
- name: Publish patronum@${{ steps.version.outputs.tag }} with RC tag | |
if: ${{ steps.rc.outputs.match != '' }} | |
working-directory: './dist/' | |
run: npm publish --tag rc | |
- name: Publish patronum@${{ steps.version.outputs.tag }} to latest | |
if: ${{ steps.next.outputs.match == '' && steps.rc.outputs.match == '' }} | |
working-directory: './dist/' | |
run: npm publish |