feat: 自动化发布代码 #9
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: GitHub Actions Build and Deploy | |
on: | |
push: | |
branches: | |
- main | |
jobs: | |
build-and-deploy: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout 🛎️ | |
uses: actions/checkout@v3 | |
with: | |
persist-credentials: false | |
- name: Install and Build 🔧 | |
run: | | |
npm i --force | |
npm run build | |
- name: 推送到代码仓库 | |
env: | |
GH_TOKEN: ${{ secrets.GH_TOKEN }} | |
GH_REF: 'github.com/songxingguo/brain.git' | |
CO_TOKEN: ${{ secrets.CO_TOKEN }} | |
CO_REF: 'e.coding.net/songxingguo/songxingguo.coding.me/brain.git' | |
run: | | |
cd ./src/.vuepress/dist | |
git init | |
git config user.name "songxingguo" | |
git config user.email "[email protected]" | |
git add . | |
git commit -m "Update Blog By GithubAction With Build $TRAVIS_BUILD_NUMBER" | |
# Github Pages | |
git push --force --quiet "https://${GH_TOKEN}@${GH_REF}" master:gh-pages | |
# Coding Pages | |
git push --force --quiet "https://zrUWsPQJyF:${CO_TOKEN}@${CO_REF}" master:master |