Update jekyll.yml #16
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
# Workflow for building and deploying a Jekyll site to GitHub Pages and Tencent | |
name: Deploy Jekyll Site | |
on: | |
# Trigger on pushes to the default branch | |
push: | |
branches: ["main"] | |
# Allow manual trigger from Actions tab | |
workflow_dispatch: | |
# Permissions for GitHub Pages deployment | |
permissions: | |
contents: read | |
pages: write | |
id-token: write | |
# Ensure only one concurrent deployment per branch | |
concurrency: | |
group: "pages-deploy" | |
cancel-in-progress: false | |
jobs: | |
# Build Job | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout Code | |
uses: actions/checkout@v4 | |
- name: Setup Ruby Environment | |
uses: ruby/setup-ruby@v1 | |
with: | |
ruby-version: '3.1' | |
bundler-cache: true | |
cache-version: 0 | |
- name: Configure Pages | |
id: pages | |
uses: actions/configure-pages@v3 | |
- name: Build Jekyll Site | |
run: bundle exec jekyll build --baseurl "${{ steps.pages.outputs.base_path }}" | |
env: | |
JEKYLL_ENV: production | |
- name: Upload Site Artifact | |
uses: actions/upload-pages-artifact@v1 | |
with: | |
name: site-artifact | |
# Deployment Job to GitHub Pages | |
deploy-pages: | |
runs-on: ubuntu-latest | |
needs: build | |
environment: | |
name: github-pages | |
url: ${{ steps.deployment.outputs.page_url }} | |
steps: | |
- name: Deploy to GitHub Pages | |
id: deployment | |
uses: actions/deploy-pages@v2 | |
with: | |
name: site-artifact | |
# Deployment Job to Tencent | |
deploy-tencent: | |
runs-on: ubuntu-latest | |
needs: build | |
steps: | |
- name: Download Site Artifact | |
uses: actions/download-artifact@v3 | |
with: | |
name: site-artifact | |
path: artifact | |
- name: Extract Artifact | |
run: | | |
mkdir -p _site | |
tar -xvf artifact/site-artifact.tar -C _site | |
- name: Deploy to Tencent Cloud | |
uses: easingthemes/ssh-deploy@main | |
env: | |
SSH_PRIVATE_KEY: ${{ secrets.CLOUD_DEPLOY_SSH }} | |
ARGS: "-avz --delete" | |
SOURCE: "_site/" | |
TARGET: ${{ secrets.TARGET }} | |
REMOTE_HOST: ${{ secrets.REMOTE_HOST }} | |
REMOTE_USER: ${{ secrets.REMOTE_USER }} |