【发布时间】:2020-04-16 06:30:55
【问题描述】:
我正在尝试使用 GitHub Actions 将 Blazor 发布到 GitHub Pages。
我用this tutorial和this example,用GitHub Pages Deploy Action。
我的 main.yml:
name: Build and Deploy
on: [push]
jobs:
build-and-deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- name: Setup .NET Core
uses: actions/setup-dotnet@v1
with:
dotnet-version: 3.1.100
- name: Publish with dotnet
run: dotnet publish --configuration Release --output build
- name: Deploy to Github Pages
uses: JamesIves/github-pages-deploy-action@releases/v3
with:
ACCESS_TOKEN: ${{ secrets.ACCESS_TOKEN }}
BASE_BRANCH: master
BRANCH: gh-pages-people # The branch the action should deploy to.
FOLDER: build/BlazorGame/dist # The folder the action should deploy.
CLEAN: true
所以,它在我的 master 中编译代码,然后应该创建新的分支并在那里部署编译的代码。
我打电话给我的分支 people-publish 并且它发布得很好:
git switch -c gh-action-temp-deployment-branch
Switched to a new branch 'gh-action-temp-deployment-branch'
git commit -m Deploying to people-publish from master 56b7095f73aeb2fa7850956778934c04d3a7eac6 --quiet
git push --force https://***@github.com/alexan1/BlazorGame.git gh-action-temp-deployment-branch:people-publish
To https://github.com/alexan1/BlazorGame.git
d2a2c28..28c546d gh-action-temp-deployment-branch -> people-publish
Running post deployment cleanup jobs... ????
rm -rf gh-action-temp-deployment-folder
git checkout --progress --force 56b7095f73aeb2fa7850956778934c04d3a7eac6
Note: switching to '56b7095f73aeb2fa7850956778934c04d3a7eac6'.
You are in 'detached HEAD' state. You can look around, make experimental
changes and commit them, and you can discard any commits you make in this
state without impacting any branches by switching back to a branch.
If you want to create a new branch to retain commits you create, you may
do so (now or later) by using -c with the switch command. Example:
git switch -c <new-branch-name>
Or undo this operation with:
git switch -
Turn off this advice by setting config variable advice.detachedHead to false
HEAD is now at 56b7095 Create .nojekyll
Completed Deployment ✅
但是这个分支并没有出现在 GitHub Pages 选项中,只有 master 和 doc。
所以我决定分支应该以 gh-pages 名称开头。
所以我把它改成了 gh-pages-people。
但是现在部署失败了:
Branch 'master' set up to track remote branch 'master' from 'origin'.
git switch --orphan gh-pages-people
Switched to a new branch 'gh-pages-people'
git reset --hard
git commit --allow-empty -m Initial gh-pages-people commit.
[gh-pages-people (root-commit) bbc1556] Initial gh-pages-people commit.
git push https://***@github.com/alexan1/BlazorGame.git gh-pages-people
remote:
remote: Create a pull request for 'gh-pages-people' on GitHub by visiting:
remote: https://github.com/alexan1/BlazorGame/pull/new/gh-pages-people
remote:
To https://github.com/alexan1/BlazorGame.git
* [new branch] gh-pages-people -> gh-pages-people
git switch master
Switched to branch 'master'
Your branch is up to date with 'origin/master'.
git switch master
Already on 'master'
Your branch is up to date with 'origin/master'.
git fetch https://***@github.com/alexan1/BlazorGame.git
From https://github.com/alexan1/BlazorGame
* branch HEAD -> FETCH_HEAD
git worktree add --checkout gh-action-temp-deployment-folder origin/gh-pages-people
fatal: invalid reference: origin/gh-pages-people
The deployment encountered an error. ❌
##[error]The process 'git' failed with exit code 128
Completed Deployment ✅
##[error]Node run failed with exit code 1
Complete job
我尝试再次更改分支名称,但总是失败。
创建了新分支,但它是空的。
我做错了什么?
【问题讨论】:
-
看来你没有在 github 上创建
gh-pages-people分支。 -
@smac89,其实是被创建的
标签: github github-pages github-actions blazor-client-side