-
Notifications
You must be signed in to change notification settings - Fork 0
72 lines (58 loc) · 2.03 KB
/
deploy.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
name: Deploy CI
on:
schedule:
- cron: "0 0 * * *"
workflow_dispatch:
push:
branches:
- main
jobs:
update-repo:
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