Skip to content

Switch gh-pages publish to GitHub Actions #225

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Aug 30, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 37 additions & 0 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
name: Publish

on:
push:
pull_request:

jobs:
publish:
name: GitHub Pages
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2

- name: Get mdBook
run: |
export MDBOOK_VERSION="v0.4.2"
export MDBOOK_TARBALL="mdbook-${MDBOOK_VERSION}-x86_64-unknown-linux-gnu.tar.gz"
export MDBOOK_URL="https://github.com/rust-lang/mdBook/releases/download/${MDBOOK_VERSION}/${MDBOOK_TARBALL}"
curl -Lf "${MDBOOK_URL}" | tar -xz

- name: Build
run: ./mdbook build

- name: Push to gh-pages
if: ${{github.ref == 'master'}}
working-directory: book
run: |
REV=$(git rev-parse --short HEAD)
git init
git remote add upstream https://x-access-token:${{secrets.GITHUB_TOKEN}}@github.com/rust-lang/api-guidelines
git config user.name "Rust API Guidelines"
git config user.email "[email protected]"
git add -A .
git commit -qm "API Guidelines @ ${{github.repository}}@${REV}"
eval `ssh-agent`
ssh-add - <<< "$deploy_key"
git push -q upstream HEAD:refs/heads/gh-pages-test --force
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
book
/book
/mdbook
/mdbook-*.tar.gz
35 changes: 0 additions & 35 deletions .travis.yml

This file was deleted.