Deploy by @Kuro-P #20
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 CI | |
run-name: Deploy by @${{ github.actor }} | |
on: | |
push: | |
branches: ["develop"] | |
pull_request: | |
branches: ["develop"] | |
env: | |
TZ: Asia/Shanghai | |
jobs: | |
build-and-deploy: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Config environment | |
env: | |
HEXO_DEPLOY_KRY_PRI: ${{ secrets.HEXO_DEPLOY_KEY }} | |
run: | | |
mkdir -p ~/.ssh/ | |
echo "$HEXO_DEPLOY_KRY_PRI" > ~/.ssh/id_rsa | |
chmod 600 ~/.ssh/id_rsa | |
ssh-keyscan github.com >> ~/.ssh/known_hosts | |
git config --global user.name "${{ github.actor }}" | |
- name: Setup node version | |
uses: actions/setup-node@v3 | |
with: | |
node-version: 18 | |
cache: 'npm' | |
- name: Get package info | |
id: package | |
uses: codex-team/[email protected] | |
- name: Get the output | |
run: | | |
echo "name: ${{ steps.package.outputs.name }}" | |
echo "version: ${{ steps.package.outputs.version }}" | |
- name: Cache node modules | |
uses: actions/cache@v3 | |
with: | |
path: node_modules | |
key: node_modules-${{hashFiles('package-lock.json')}} | |
restore-keys: node_modules- | |
- name: Install dependencies | |
run: npm install | |
- name: Build post files | |
run: npm run build | |
- name: Build douban files | |
run: npm run douban | |
- name: Deploy | |
run: npm run deploy | |
env: | |
PERSONAL_TOKEN: ${{secrets.HEXO_DEPLOY_TOKEN}} | |