Skip to content

chore: remove unused dependency #37

chore: remove unused dependency

chore: remove unused dependency #37

Workflow file for this run

name: Publish Beta
on:
workflow_dispatch:
push:
branches:
- main
paths:
- 'package.json'
- '**/*.ts'
- '!**/*.test.ts'
- '!vitest.config.ts'
concurrency:
group: ${{ github.workflow }}
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 }}
stable-version: ${{ steps.get-stable-version.outputs.stable-version }}
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: pnpm/action-setup@v4
- uses: actions/setup-node@v4
with:
node-version: '22.x'
cache: pnpm
- run: pnpm install
- name: Prepare build
run: pnpm build
- name: Retrieve stable version
id: get-stable-version
run: |
echo "::set-output name=stable-version::v$(npm view radashi version)"
- name: Lint commit messages
run: pnpm -s dlx commitlint --from ${{ steps.get-stable-version.outputs.stable-version }}
- name: Calculate version
id: set-version
run: |
pnpm -s 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 -s view radashi@${{ steps.set-version.outputs.version }}; then
echo "🚫 Version ${{ steps.set-version.outputs.version }} already exists"
echo "::set-output name=version-exists::true"
else
echo "🟢 Version ${{ steps.set-version.outputs.version }} is available"
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
- uses: actions/setup-node@v4
with:
node-version: '22.x'
cache: pnpm
- run: pnpm install
- 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
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
cache: pnpm
- run: pnpm install
- run: pnpm test
publish-beta:
name: Publish Beta to NPM
needs: [test, prepare-version]
runs-on: ubuntu-latest
permissions:
contents: read
id-token: write
steps:
- uses: actions/checkout@v4
- uses: pnpm/action-setup@v4
- uses: actions/setup-node@v4
with:
registry-url: 'https://registry.npmjs.org'
node-version: '22.x'
cache: pnpm
- run: pnpm install
- run: pnpm build
- run: |
npm version ${{ needs.prepare-version.outputs.version }} --no-git-tag-version
npm publish --tag beta --ignore-scripts
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
- uses: actions-ecosystem/action-push-tag@v1
with:
tag: v${{ needs.prepare-version.outputs.version }}
- name: Comment on Pull Request
uses: actions/github-script@v6
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
script: |
const commit = context.payload.head_commit
console.log('commit', commit)
const prNumber = commit.message.match(/\(#(\d+)\)/)?.[1]
if (prNumber) {
const version = '${{ needs.prepare-version.outputs.version }}'
const body = `
A new beta version \`${version}\` has been published to NPM. :rocket:
To install:
\`\`\`sh
pnpm add radashi@${version}
\`\`\`
The \`radashi@beta\` tag also includes this PR.
<a href="https://github.com/radashi-org/radashi/compare/${{ needs.prepare-version.outputs.stable-version }}...${commit.id}">
<img src="https://github.com/radashi-org/radashi/raw/main/img/changes-button.png" alt="See the changes" width="250px" />
</a>
`
await github.rest.issues.createComment({
issue_number: prNumber,
owner: context.repo.owner,
repo: context.repo.repo,
body: body
})
}
- name: Set up Deno
uses: denoland/setup-deno@v1
- name: Publish to JSR
run: |
deno run -A jsr:@david/[email protected] --allow-slow-types --allow-dirty
env:
GITHUB_REF: refs/tags/v${{ needs.prepare-version.outputs.version }}