Skip to content

Publish radashi@beta #9

Publish radashi@beta

Publish radashi@beta #9

Workflow file for this run

name: Publish Beta
on:
workflow_dispatch:
push:
branches:
- main
paths:
- 'package.json'
- '**/*.ts'
- '!**/*.test.ts'
- '!vitest.config.ts'
jobs:
prepare-version:
name: Prepare Version
runs-on: ubuntu-latest
outputs:
version: ${{ steps.set-version.outputs.version }}
version-exists: ${{ steps.check-version.outputs.version-exists }}
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: pnpm/action-setup@v4
with:
run_install: true
- uses: actions/setup-node@v4
with:
node-version: '22.x'
cache: pnpm
- name: Lint commit messages
run: pnpm dlx commitlint --from $(git describe --tags --abbrev=0)
- name: Prepare build
run: pnpm build
- name: Calculate version
id: set-version
run: |
pnpm install -g [email protected]
echo "::set-output name=version::$(happy-next-version)-beta.$(find dist package.json -type f -exec shasum -a 256 {} + | shasum -a 256 | cut -c 1-7)"
- name: Check version
id: check-version
run: |
if npm view radashi@${{ steps.set-version.outputs.version }}; then
echo "::set-output name=version-exists::true"
else
echo "::set-output name=version-exists::false"
fi
lint:
if: ${{ needs.prepare-version.outputs.version-exists == false }}
name: Lint
needs: prepare-version
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: pnpm/action-setup@v4
with:
run_install: true
- uses: actions/setup-node@v4
with:
node-version: '22.x'
cache: pnpm
- run: pnpm lint
test:
name: Run Tests
needs: lint
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [18.x, 20.x, 22.x]
steps:
- uses: actions/checkout@v4
- uses: pnpm/action-setup@v4
with:
run_install: true
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
cache: pnpm
- run: pnpm test
publish-beta:
name: Publish Beta to NPM
needs: [test, prepare-version]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: pnpm/action-setup@v4
with:
run_install: true
- uses: actions/setup-node@v4
with:
node-version: '22.x'
cache: pnpm
- run: |
npm version ${{ needs.prepare-version.outputs.version }} --no-git-tag-version
npm publish --tag beta --dry-run
env:
npm_config__authtoken: ${{ secrets.NPM_TOKEN }}