我需要为使用mdBook实用程序编写的帮助文档提供一个GitHub工作流,其中mdBook将工件生成为
book
目录。
在将这些工件移动到本地Ubuntu存储库的顶部后,我会将本地存储库的更改提交到特定的GitHub分支。
我试过了:
mv -f book .
rm -rf book
我得到:
mv:“书”和“/书是同一个文件
我也试过:
mv -f book ..
rm -rf book
它有效,但我什么也没得到(我丢失了所有文件)。
我试过了
cp -r book <something like "." or "..">
,但它也没有走。
我想我不能尝试使用
/
或
~
作为复制目标,因为工作存储库可能位于另一个目录下。
以下是完整的工作流程:
name: Build
on:
push:
branches: [ "master" ]
pull_request:
branches: [ "master" ]
workflow_dispatch:
inputs:
logLevel:
description: 'Log level'
required: true
default: 'warning'
type: choice
options:
- info
- warning
- debug
tags:
description: 'Build'
required: false
type: boolean
environment:
description: 'Environment to run tests against'
type: environment
required: true
permissions:
contents: write
env:
CARGO_TERM_COLOR: always
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Install mdbook CLI
run: cargo install mdbook --version ~0.4
- name: Build book
run: mdbook build
- name: Git commit report
run: |
mv -f book .
rm -rf book
git config --global user.name '<username>'
git config --global user.email '<e-mail>'
git switch -C live
git rm -r .github src theme .gitignore book.toml
git add .
git commit -m "Automated report"
git push origin -f live