-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
zola building and deployment Github Action
- Loading branch information
1 parent
8119aa0
commit 99856cc
Showing
1 changed file
with
47 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
name: Zola on GitHub Pages | ||
|
||
on: | ||
push: | ||
branches: | ||
- master | ||
- dev-docs | ||
pull_request: | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
if: github.ref != 'refs/heads/master' | ||
steps: | ||
- name: Checkout master | ||
uses: actions/[email protected] | ||
- name: Build only | ||
uses: shalzz/[email protected] | ||
env: | ||
BUILD_DIR: . | ||
BUILD_ONLY: true | ||
BUILD_FLAGS: --drafts | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
build_and_deploy: | ||
runs-on: ubuntu-latest | ||
if: github.ref == 'refs/heads/master' | ||
steps: | ||
- name: Checkout master | ||
uses: actions/[email protected] | ||
- name: Build and deploy | ||
uses: shalzz/[email protected] | ||
env: | ||
BUILD_DIR: . | ||
PAGES_BRANCH: gh-pages | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
- name: Deploy developer docs | ||
working-directory: ${{github.workspace}} | ||
run: | | ||
git config user.name "GitHub Actions" | ||
git config user.email "[email protected]" | ||
git fetch origin gh-pages:gh-pages developer-docs:developer-docs | ||
git checkout gh-pages | ||
git cherry-pick developer-docs || true | ||
git remote add destination "https://${{github.actor}}:${{github.token}}@github.com/${{github.repository}}.git" | ||
git push destination gh-pages |