|
1 | | -# This workflow uses actions that are not certified by GitHub. |
2 | | -# They are provided by a third-party and are governed by |
3 | | -# separate terms of service, privacy policy, and support |
4 | | -# documentation. |
5 | | - |
6 | | -# Sample workflow for building and deploying a Jekyll site to GitHub Pages |
7 | | -name: Deploy Jekyll site to Pages |
| 1 | +# Workflow for building and deploying a Jekyll site to GitHub Pages and Tencent |
| 2 | +name: Deploy Jekyll Site |
8 | 3 |
|
9 | 4 | on: |
10 | | - # Runs on pushes targeting the default branch |
| 5 | + # Trigger on pushes to the default branch |
11 | 6 | push: |
12 | 7 | branches: ["main"] |
13 | 8 |
|
14 | | - # Allows you to run this workflow manually from the Actions tab |
| 9 | + # Allow manual trigger from Actions tab |
15 | 10 | workflow_dispatch: |
16 | 11 |
|
17 | | -# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages |
| 12 | +# Permissions for GitHub Pages deployment |
18 | 13 | permissions: |
19 | 14 | contents: read |
20 | 15 | pages: write |
21 | 16 | id-token: write |
22 | 17 |
|
23 | | -# Allow only one concurrent deployment, skipping runs queued between the run in-progress and latest queued. |
24 | | -# However, do NOT cancel in-progress runs as we want to allow these production deployments to complete. |
| 18 | +# Ensure only one concurrent deployment per branch |
25 | 19 | concurrency: |
26 | | - group: "pages" |
| 20 | + group: "pages-deploy" |
27 | 21 | cancel-in-progress: false |
28 | 22 |
|
29 | 23 | jobs: |
30 | | - # Build job |
| 24 | + # Build Job |
31 | 25 | build: |
32 | 26 | runs-on: ubuntu-latest |
33 | 27 | steps: |
34 | | - - name: Checkout |
| 28 | + - name: Checkout Code |
35 | 29 | uses: actions/checkout@v4 |
36 | | - - name: Setup Ruby |
37 | | - uses: ruby/setup-ruby@v1 # v1.146.0 |
| 30 | + |
| 31 | + - name: Setup Ruby Environment |
| 32 | + uses: ruby/setup-ruby@v1 |
38 | 33 | with: |
39 | | - ruby-version: '3.1' # Not needed with a .ruby-version file |
40 | | - bundler-cache: true # runs 'bundle install' and caches installed gems automatically |
41 | | - cache-version: 0 # Increment this number if you need to re-download cached gems |
42 | | - - name: Setup Pages |
| 34 | + ruby-version: '3.1' |
| 35 | + bundler-cache: true |
| 36 | + cache-version: 0 |
| 37 | + |
| 38 | + - name: Configure Pages |
43 | 39 | id: pages |
44 | 40 | uses: actions/configure-pages@v3 |
45 | | - - name: Build with Jekyll |
46 | | - # Outputs to the './_site' directory by default |
| 41 | + |
| 42 | + - name: Build Jekyll Site |
47 | 43 | run: bundle exec jekyll build --baseurl "${{ steps.pages.outputs.base_path }}" |
48 | 44 | env: |
49 | 45 | JEKYLL_ENV: production |
50 | | - - name: Upload artifact |
51 | | - # Automatically uploads an artifact from the './_site' directory by default |
| 46 | + |
| 47 | + - name: Upload Site Artifact |
52 | 48 | uses: actions/upload-pages-artifact@v1 |
53 | 49 | with: |
54 | 50 | name: site-artifact |
55 | 51 |
|
56 | | - # Deployment job |
57 | | - deploy: |
| 52 | + # Deployment Job to GitHub Pages |
| 53 | + deploy-pages: |
| 54 | + runs-on: ubuntu-latest |
| 55 | + needs: build |
58 | 56 | environment: |
59 | 57 | name: github-pages |
60 | 58 | url: ${{ steps.deployment.outputs.page_url }} |
61 | | - runs-on: ubuntu-latest |
62 | | - needs: build |
63 | 59 | steps: |
64 | 60 | - name: Deploy to GitHub Pages |
65 | 61 | id: deployment |
66 | 62 | uses: actions/deploy-pages@v2 |
67 | 63 |
|
68 | | - - name: Download artifact |
69 | | - uses: actions/download-pages-artifact@v1 |
| 64 | + # Deployment Job to Tencent |
| 65 | + deploy-tencent: |
| 66 | + runs-on: ubuntu-latest |
| 67 | + needs: build |
| 68 | + steps: |
| 69 | + - name: Download Site Artifact |
| 70 | + uses: actions/download-artifact@v3 |
70 | 71 | with: |
71 | 72 | name: site-artifact |
72 | 73 | path: _site |
73 | | - |
74 | | - - name: Deploy to Tencent |
| 74 | + |
| 75 | + - name: Deploy to Tencent Cloud |
75 | 76 | uses: easingthemes/ssh-deploy@main |
76 | 77 | env: |
77 | 78 | SSH_PRIVATE_KEY: ${{ secrets.CLOUD_DEPLOY_SSH }} |
|
0 commit comments