Skip to content

Commit 4faec48

Browse files
committed
Switch gh-pages publish to GitHub Actions
1 parent 524e561 commit 4faec48

File tree

3 files changed

+42
-36
lines changed

3 files changed

+42
-36
lines changed

.github/workflows/deploy.yml

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
name: Publish
2+
3+
on:
4+
push:
5+
pull_request:
6+
7+
jobs:
8+
publish:
9+
name: GitHub Pages
10+
runs-on: ubuntu-latest
11+
steps:
12+
- uses: actions/checkout@v2
13+
14+
- name: Get mdBook
15+
run: |
16+
export MDBOOK_VERSION="v0.4.2"
17+
export MDBOOK_TARBALL="mdbook-${MDBOOK_VERSION}-x86_64-unknown-linux-gnu.tar.gz"
18+
export MDBOOK_URL="https://github.com/rust-lang/mdBook/releases/download/${MDBOOK_VERSION}/${MDBOOK_TARBALL}"
19+
curl -Lf "${MDBOOK_URL}" | tar -xz
20+
21+
- name: Build
22+
run: ./mdbook build
23+
24+
- name: Push to gh-pages
25+
if: ${{github.ref == 'master'}}
26+
working-directory: book
27+
env:
28+
deploy_key: ${{secrets.DEPLOY_KEY}}
29+
run: |
30+
REV=$(git rev-parse --short HEAD)
31+
git init
32+
git remote add upstream https://x-access-token:${{secrets.GITHUB_TOKEN}}@github.com/rust-lang/api-guidelines
33+
git config user.name "Rust API Guidelines"
34+
git config user.email "[email protected]"
35+
git add -A .
36+
git commit -qm "API Guidelines @ ${{github.repository}}@${REV}"
37+
eval `ssh-agent`
38+
ssh-add - <<< "$deploy_key"
39+
git push -q upstream HEAD:refs/heads/gh-pages-test --force

.gitignore

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,3 @@
1-
book
1+
/book
2+
/mdbook
3+
/mdbook-*.tar.gz

.travis.yml

Lines changed: 0 additions & 35 deletions
This file was deleted.

0 commit comments

Comments
 (0)