Skip to content

Deploy CI

Deploy CI #315

Workflow file for this run

name: Deploy CI
on:
schedule:
- cron: "0 0 * * *"
workflow_dispatch:
push:
branches:
- main
# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
permissions:
contents: write
pages: write
id-token: write
concurrency:
group: "pages"
cancel-in-progress: false
jobs:
deploy:
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Clean up repository
run: |
find . -maxdepth 1 ! -name '.github' ! -name '.git' ! -name '.' ! -name '..' -exec rm -rf {} \;
- name: Clone rust-lang-uz/book
run: git clone https://github.com/rust-lang-uz/book rust-book --depth 1
- name: Clone rust-lang-uz/rust-by-example
run: git clone https://github.com/rust-lang-uz/rust-by-example rust-example --depth 1
- name: Install mdbook
run: |
mkdir -p .tools
curl -Lf https://github.com/rust-lang/mdBook/releases/download/v0.4.35/mdbook-v0.4.35-x86_64-unknown-linux-gnu.tar.gz | tar -xz --directory=./.tools
ls -la .tools
echo `pwd`/.tools >> $GITHUB_PATH
- name: Build rust-book
run: |
mdbook build
mv book ../../book
working-directory: rust-book/rustbook-uz
- name: Build rust-example
run: |
mdbook build
mv book ../../rust-by-example
working-directory: rust-example/rustbook-uz
- name: Clean up
run: |
rm -rf rust-book
rm -rf rust-example
rm -rf .tools
- name: Copy files from base
run: |
ls -la .github/base
cp -r .github/base/* .
ls -la .
- name: Setup git credentials
run: |
# Use github actions default username and email
git config user.name "github-actions[bot]"
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
- name: Commit and Push changes
run: |
git add .
[[ -z $(git status -uno --porcelain) ]] && echo "this branch is clean, no need to push..." && exit 0;
git commit -m "[BOT] Updating $GITHUB_SHA content"
git push origin main --force
- name: Setup Pages
uses: actions/configure-pages@v5
- name: Upload artifact
uses: actions/upload-pages-artifact@v3
with:
path: '.'
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4