Release Package #2
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
name: Release Package | ||
on: | ||
workflow_dispatch: | ||
inputs: | ||
project: | ||
description: "The package folder name under packages/ to release (e.g. my-package)" | ||
required: true | ||
jobs: | ||
release: | ||
runs-on: ubuntu-latest | ||
permissions: | ||
contents: write # Allows pushing changes and creating releases | ||
issues: write | ||
pull-requests: write | ||
steps: | ||
# Checkout repository | ||
- name: Checkout repository | ||
uses: actions/checkout@v3 | ||
# Setup Node.js (v20+) | ||
- name: Setup Node.js | ||
uses: actions/setup-node@v3 | ||
with: | ||
node-version: "20" | ||
registry-url: "https://registry.npmjs.org" | ||
# Setup pnpm (using pnpm/action-setup@v4) | ||
- name: Setup pnpm | ||
uses: pnpm/action-setup@v4 | ||
with: | ||
version: "8" # or whichever version of pnpm you prefer | ||
# Cache pnpm store for faster installs | ||
- name: Cache pnpm store | ||
uses: actions/cache@v3 | ||
with: | ||
path: ~/.pnpm-store | ||
key: ${{ runner.os }}-pnpm-${{ hashFiles('**/pnpm-lock.yaml') }} | ||
restore-keys: | | ||
${{ runner.os }}-pnpm- | ||
# Use sparse-checkout if releasing from bnb-chain example-hub (to avoid cloning the entire repo) | ||
# Here we assume that if the project input is not a URL, it is a bnb-chain example name. | ||
- name: Install dependencies and build package | ||
working-directory: packages/${{ github.event.inputs.project }} | ||
run: | | ||
pnpm install | ||
pnpm run build || echo "No build script found" | ||
# Publish to NPM and create GitHub release using semantic-release. | ||
# Note: To limit release notes to commits with the create-bnb theme, configure semantic-release (e.g. releaseRules) | ||
- name: Run semantic-release | ||
working-directory: packages/${{ github.event.inputs.project }} | ||
uses: cycjimmy/semantic-release-action@v4 | ||
Check failure on line 56 in .github/workflows/release.yml
|
||
with: | ||
config_file: ".releaserc.js" | ||
package: ${{ github.event.inputs.project }} | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
NPM_TOKEN: ${{ secrets.NPM_TOKEN }} |