Skip to content

Commit

Permalink
Merge pull request #9 from jmlntw/update-ci
Browse files Browse the repository at this point in the history
This pull request makes GitHub Actions use peaceiris/actions-gh-pages to
deploy pages.
  • Loading branch information
mnghsn authored Sep 15, 2021
2 parents 6e2b11a + 37946d2 commit fb4daf6
Showing 1 changed file with 27 additions and 17 deletions.
44 changes: 27 additions & 17 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,25 @@ on:
- master

jobs:
prepare:
name: Prepare
runs-on: ubuntu-latest
outputs:
short_sha: ${{ steps.set_outputs.outputs.short_sha }}
steps:
- name: Checkout repository
uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Set outputs
id: set_outputs
run: |
echo "::set-output name=short_sha::$(git rev-parse --short "${GITHUB_SHA}")"
build:
name: Build
needs:
- prepare
runs-on: ubuntu-latest
steps:
- name: Checkout repository
Expand All @@ -35,31 +52,24 @@ jobs:
deploy:
name: Deploy
needs:
- prepare
- build
if: |
github.event_name == 'push' &&
github.ref == 'refs/heads/master'
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v2
with:
ref: gh-pages
path: gh-pages
- name: Download GitHub Pages from artifact
uses: actions/download-artifact@v2
with:
name: gh-pages
path: _site
- name: Sync changes to GitHub Pages branch
run: |
rsync --archive --checksum --delete-after --exclude=.git --verbose _site/ gh-pages/
- name: Push changes to GitHub Pages branch
working-directory: gh-pages
run: |
touch .nojekyll
git config --local user.name 'github-actions[bot]'
git config --local user.email '41898282+github-actions[bot]@users.noreply.github.com'
git add --all .
git commit --message="Deploy GitHub Pages from commit $(git rev-parse --short "${GITHUB_SHA}")" || true
git push origin gh-pages
- name: Deploy to GitHub Pages branch
uses: peaceiris/actions-gh-pages@v3
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: _site
publish_branch: gh-pages
user_name: github-actions[bot]
user_email: 41898282+github-actions[bot]@users.noreply.github.com
full_commit_message: Deploy GitHub Pages from commit ${{ needs.prepare.outputs.short_sha }}

0 comments on commit fb4daf6

Please sign in to comment.