name: github pages update
on:
push:
branches: [ "main" ]
workflow_dispatch:
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Install stable toolchain
uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: stable
override: true
- name: git clone
run: |
git clone https://github.com/mendelsshop/loading_bar.git
cd loading_bar
- name: cargo doc
run: |
cd loading_bar
cargo doc --no-deps --all-features --release --all
- name: switch to gh-pages branch and copy docs
run: |
cd loading_bar
mkdir ../gh_pages
echo "made gh_pages dir"
cp -r target/doc/* ../gh_pages/
echo "copied docs to temp dir"
git switch gh-pages
ls -la
echo "switched to gh-pages branch"
ls ../gh_pages
echo "listing gh-pages dir"
cp -rf ../gh_pages/* doc
echo "copied docs to gh-pages branch"
- name: configure git
run: |
cd loading_bar
git config user.name "github-actions"
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
- name: commit gh_pages
env:
GITHUB_TOKEN: ${{ secrets.PUSH_TOKEN }}
run: |
cd loading_bar
git add doc
echo "Updateing gh-pages"
git commit -m "Update docs"
echo "Pushing to gh-pages"
git remote set-url --push origin https://mendelsshop:$GITHUB_TOKEN@github.com/mendelsshop/loading_bar
git branch
git push origin gh-pages