Deploy by @Kuro-P #18
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: ["test"] | |
pull_request: | |
branches: ["test"] | |
env: | |
TZ: Asia/Shanghai | |
jobs: | |
test-package-version: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Setup node version | |
uses: actions/setup-node@v3 | |
with: | |
node-version: 18 | |
cache: 'npm' | |
- name: Compare version | |
run: node common/compare-version.js | |
- name: Console test | |
run: echo "version check completely" | |
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: Check version change and commit message? | |
# run: echo "IS_CHANGED=$(git diff './package.json')" | |
# run: echo "IS_CHANGED=$(node common/compare-version.js)" | |
- 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}} | |