Skip to content

fix: 修复"Workspaces can only be enabled in private projects"的报错 #15

fix: 修复"Workspaces can only be enabled in private projects"的报错

fix: 修复"Workspaces can only be enabled in private projects"的报错 #15

name: Publish Alpha
on:
pull_request:
branches:
- main
types: [opened, synchronize, reopened]
jobs:
publish-alpha:
runs-on: ubuntu-latest
permissions:
contents: write
packages: write
steps:
# - name: Display debug information # to debug
# run: |
# echo "Current GitHub context:"
# echo "${{ toJson(github) }}"
- name: Check if branch exists
id: check_branch
run: |
BRANCH_NAME="${{ github.head_ref }}"
if git show-ref --verify --quiet refs/heads/"$BRANCH_NAME"; then
echo "Branch '$BRANCH_NAME' exists."
echo "exists=true" >> $GITHUB_ENV
else
echo "Branch '$BRANCH_NAME' does not exist.It is a pull request across repos."
exit 1
fi
- name: Checkout Branch
uses: actions/checkout@v4
with:
ref: ${{ github.head_ref }}
- name: Setup Node
uses: actions/setup-node@v4
with:
node-version: 18
registry-url: "https://registry.npmjs.org"
- name: Install Dependencies
run: npx yarn
- name: Setup git userName
run: git config user.name 'yukilzw'
- name: Setup git userEmail
run: git config user.email 'liuzhanwei@bytedance.com'
- name: Lerna Version alpha
run: npx lerna version prerelease --preid=alpha --yes
env:
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
- name: Lerna Publish Alpha
run: npx lerna publish from-package --dist-tag alpha --yes
env:
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}