baka #427
This file contains 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: generate mirror | |
on: | |
push: | |
branches: | |
- master | |
paths: | |
- '.github/workflows/gen_mirror.yml' | |
- '.cargo/config.toml' | |
- 'Cargo.toml' | |
- 'static/**' | |
- 'crates/**' | |
workflow_dispatch: | |
jobs: | |
generate: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
with: | |
ref: master | |
path: master | |
- uses: actions/checkout@v2 | |
with: | |
ref: doc | |
path: doc | |
- name: Install latest Rust toolchain | |
uses: actions-rs/toolchain@v1 | |
with: | |
toolchain: stable | |
override: true | |
- name: Generate mirror | |
run: | | |
pwd | |
[[ -d doc/gen/generated ]] && rm -Rf doc/gen/generated | |
cd master/script | |
cargo run --bin revision-art ${GITHUB_SHA} >> ../static/nekolib/src/lib.rs | |
cd ../.. | |
cp -R master/static doc/gen/generated | |
cd doc | |
[[ -d trigger ]] || mkdir trigger | |
date --rfc-3339=seconds > trigger/gen_doc | |
echo ${GITHUB_SHA} >> trigger/gen_doc | |
cp trigger/gen_doc trigger/doc_test | |
cd gen | |
cargo run | |
cd .. | |
git add . | |
ls -a * | |
git status | |
git config user.name github-actions | |
git config user.email [email protected] | |
git commit -m '[auto-generated]' || true | |
- name: Push | |
uses: cpina/github-action-push-to-another-repository@main | |
# run: | | |
# cd doc | |
# git log | |
# git push | |
env: | |
API_TOKEN_GITHUB: ${{ secrets.GH_TOKEN }} | |
with: | |
source-directory: doc | |
target-branch: doc | |
destination-github-username: 'rsk0315' | |
destination-repository-name: 'library-rs' | |
user-email: '[email protected]' | |
- name: Invoke doctest | |
uses: benc-uk/workflow-dispatch@v1 | |
with: | |
workflow: 'test --doc' | |
token: ${{ secrets.GH_TOKEN }} | |
- name: Invoke generate document | |
uses: benc-uk/workflow-dispatch@v1 | |
with: | |
workflow: generate document | |
token: ${{ secrets.GH_TOKEN }} | |