From 2e4c07396364fd021fb87b87c3c52a774aed2b92 Mon Sep 17 00:00:00 2001 From: ahonn Date: Sun, 4 Feb 2024 14:25:06 +1100 Subject: [PATCH] feat: update deploy github pages workflow --- .github/workflows/deploy.yml | 38 -------------------------- .github/workflows/pages.yml | 53 ++++++++++++++++++++++++++++++++++++ 2 files changed, 53 insertions(+), 38 deletions(-) delete mode 100644 .github/workflows/deploy.yml create mode 100644 .github/workflows/pages.yml diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml deleted file mode 100644 index 50b108e4..00000000 --- a/.github/workflows/deploy.yml +++ /dev/null @@ -1,38 +0,0 @@ -name: deploy - -on: - push: - branches: - - master - - demo-source - -jobs: - build: - runs-on: ubuntu-latest - steps: - - name: Checkout branch - uses: actions/checkout@master - with: - ref: demo-source - - name: Use Node.js - uses: actions/setup-node@master - with: - node-version: '18.x' - - name: Prepare source - run: | - npm install hexo-renderer-ejs hexo-renderer-dartsass --save - git clone -b master https://github.com/ahonn/hexo-theme-even.git themes/even - cp themes/even/_config.yml.example themes/even/_config.yml - npm install - - name: Run hexo generate - run: | - npm i -g hexo-cli - hexo generate - - name: Run hexo deploy - env: - GH_DEPLOY_TOKEN: ${{secrets.GH_DEPLOY_TOKEN}} - run: | - git config --global user.name 'ahonn' - git config --global user.email 'ahonn95@outlook.com' - sed -i "s//${GH_DEPLOY_TOKEN}/g" ./_config.yml - hexo deploy diff --git a/.github/workflows/pages.yml b/.github/workflows/pages.yml new file mode 100644 index 00000000..0ea88754 --- /dev/null +++ b/.github/workflows/pages.yml @@ -0,0 +1,53 @@ +name: GitHub Pages + +on: + push: + branches: + - master + - demo-source + +jobs: + build: + runs-on: ubuntu-latest + steps: + - name: Checkout branch + uses: actions/checkout@master + with: + ref: demo-source + - name: Use Node.js + uses: actions/setup-node@master + with: + node-version: '18.x' + - name: Cache NPM dependencies + uses: actions/cache@v2 + with: + path: node_modules + key: ${{ runner.OS }}-npm-cache + restore-keys: | + ${{ runner.OS }}-npm-cache + - name: Prepare source + run: | + npm install hexo-renderer-ejs hexo-renderer-dartsass --save + git clone -b master https://github.com/ahonn/hexo-theme-even.git themes/even + cp themes/even/_config.yml.example themes/even/_config.yml + - name: Install Dependencies + run: npm install + - name: Build + run: npm run build + - name: Upload Pages artifact + uses: actions/upload-pages-artifact@v2 + with: + path: ./public + deploy: + needs: build + permissions: + pages: write + id-token: write + environment: + name: github-pages + url: ${{ steps.deployment.outputs.page_url }} + runs-on: ubuntu-latest + steps: + - name: Deploy to GitHub Pages + id: deployment + uses: actions/deploy-pages@v2