我使用以下 GitHub Actions(新YAML
版本)工作流程从我的lerna
monorepo 发布包以推送到master
:
name: CD
on:
push:
branches:
- master
jobs:
deployPackages:
name: Deploy Packages
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@master
- name: Checkout master
run: git checkout master
- name: Install
uses: nuxt/actions-yarn@master
with:
args: install
- name: Build
uses: nuxt/actions-yarn@master
with:
args: build
- name: Lint
uses: nuxt/actions-yarn@master
with:
args: lint
- name: Test
uses: ianwalter/puppeteer@v1.0.0
env:
CC_TEST_REPORTER_ID: ${{ secrets.CC_TEST_REPORTER_ID }}
with:
entrypoint: yarn
args: test:ci
- name: Deploy Packages
uses: nuxt/actions-yarn@master
env:
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
DEPLOYING_USER_NAME: ${{ secrets.DEPLOYING_USER_NAME }}
GH_PAT: ${{ secrets.GH_PAT }}
with:
args: deploy:ci
- name: Build Docs
uses: nuxt/actions-yarn@master
with:
args: docs
- name: Deploy Docs
uses: maxheld83/ghpages@v0.2.1
env:
BUILD_DIR: _site/
GH_PAT: ${{ secrets.GH_PAT }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
deploy:ci
npm 脚本执行以下 bash 脚本:
echo "Authenticating with Registry..."
npm config set registry //registry.npmjs.org/:_authToken=$NPM_TOKEN -q
echo "Adding Git Remote..."
git remote rm origin
git remote add origin "https://$DEPLOYING_USER_NAME:$GH_PAT@github.com/SCOPE/REPO_NAME.git"
git fetch
git tag -d master
echo "Configuring CI Git User..."
git config --global user.email octobot@github.com
git config --global user.name GitHub Actions
echo "Publishing Packages..."
npx lerna publish \
--message "chore: release new versions" \
--yes
这会导致以下错误:
lerna info execute Skipping releases
lerna info git Pushing tags...
lerna ERR! Error: Command failed: git push --follow-tags --no-verify origin master
lerna ERR! error: src refspec refs/heads/master matches more than one.
lerna ERR! fatal: The remote end hung up unexpectedly
lerna ERR! error: failed to push some refs to 'https://***:***@github.com/SCOPE/REPO_NAME.git'
lerna ERR!
lerna ERR! at makeError (/github/workspace/node_modules/execa/index.js:174:9)
lerna ERR! at Promise.all.then.arr (/github/workspace/node_modules/execa/index.js:278:16)
是什么导致了上述错误?