Created
August 30, 2019 05:10
-
-
Save Gesrua/5b8090aadd4132502bab0af94a43aaa3 to your computer and use it in GitHub Desktop.
GitHub Actions Hexo
This file contains hidden or 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
name: CI | |
on: | |
push: | |
branches: | |
- master | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@master | |
- uses: actions/setup-node@master | |
with: | |
node-version: 10.x | |
- name: Install Dependencies | |
run: | | |
git submodule init | |
git submodule update | |
npm install -g hexo | |
npm install | |
- name: Clean | |
run: hexo clean | |
- name: Generate | |
run: hexo generate | |
- name: Checkdir | |
run: ls ./public | |
- name: Deploy | |
env: | |
GH_PAT: ${{ secrets.GH_PAT }} | |
Page_repo: "Chaigidel/chaigidel.github.io" | |
run: sh publish-to-gh-pages.sh |
This file contains hidden or 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
#!/bin/bash | |
set -ev | |
remote_repo="https://${GH_PAT}@github.com/${Page_repo}.git" | |
remote_branch="master" | |
cd public | |
git init | |
git config user.name "GitHub Actions" | |
git config user.email "[email protected]" | |
git add . | |
git commit -m "Auto Builder at `date +"%Y-%m-%d %H:%M"` from ${GITHUB_REPOSITORY}" | |
git push --force "${remote_repo}" master:${remote_branch} | |
echo "Deploy complete" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment