Deploy #38
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
name: Deploy | |
on: | |
workflow_dispatch: | |
push: | |
branches: | |
- master | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v1 | |
- uses: actions/setup-node@v1 | |
with: | |
node-version: '12.x' | |
- name: Setup Hexo | |
run: | | |
npm install hexo-cli -g | |
npm install | |
- name: Deploy to COS | |
env: | |
COS_SECRET_ID: ${{ secrets.COS_SECRET_ID }} | |
COS_SECRET_KEY: ${{ secrets.COS_SECRET_KEY }} | |
COS_BUCKET: ${{ secrets.COS_BUCKET }} | |
COS_REGION: ${{ secrets.COS_REGION }} | |
run: | | |
hexo clean && hexo g && hexo d | |
- name: Deploy to Github Pages | |
env: | |
GH_REF: github.com/myloft/blog | |
CI_TOKEN: ${{ secrets.CI_TOKEN }} | |
run: | | |
git clone https://${GH_REF} .deploy_git | |
cd .deploy_git | |
git checkout master | |
cd ../ | |
mv .deploy_git/.git/ ./public/ | |
cd ./public | |
git init | |
git config user.name "Solyn" | |
git config user.email "[email protected]" | |
git add . | |
git commit -m ":memo: Update blog by Actions" | |
git push --force --quiet "https://${CI_TOKEN}@${GH_REF}" master:gh-pages |