Skip to content
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

Fix gh-actions trying to deploy PRs, allow manual trigger, use gh-actions account for auto commit. #43

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
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
12 changes: 8 additions & 4 deletions .github/workflows/rust.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
name: Rust

on:
push:
workflow_dispatch:
push:
branches: [ master ]
pull_request:
branches: [ master ]
Expand All @@ -21,18 +22,21 @@ jobs:
- uses: actions/checkout@v2
with:
fetch-depth: 0

- name: Prepare pages
run: ./prepare-pages.sh

- name: Deploy GitHub Pages
# Do not deploy PRs.
if: ${{ github.event_name != 'pull_request' }}
run: |
git worktree add gh-pages gh-pages
git config user.name "Deploy from CI"
git config user.email ""
cd gh-pages
# Delete the ref to avoid keeping history.
git update-ref -d refs/heads/gh-pages
rm -rf *
mv ../output/* .
git add .
git commit -m "Deploy $GITHUB_SHA to gh-pages"
git -c 'user.name=github-actions[bot]' -c 'user.email=41898282+github-actions[bot]@users.noreply.github.com' \
commit -m "Deploy $GITHUB_SHA to gh-pages"
git push --force