-
Notifications
You must be signed in to change notification settings - Fork 0
88 lines (84 loc) · 2.48 KB
/
deploy-prod.yml
File metadata and controls
88 lines (84 loc) · 2.48 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
name: Deploy to Production Environment
concurrency: production
on:
# Can be triggered manually
workflow_dispatch:
# Runs every Monday at 20:30 UTC
schedule:
- cron: '30 20 * * 1'
env:
ENV: production
TARGET_REPO_NAME: learn-software-engineering.github.io
SITE_URL: https://learn-software.com
INDEXNOW_KEY: 53f1811377874f608f161d768a9c0b78
jobs:
spell-checker:
runs-on: ubuntu-latest
container: ghcr.io/cn-docker/cspell:10.0.0
steps:
- name: Checkout
uses: actions/checkout@v6
- name: CSpell English
run: task spell-check
build:
needs: spell-checker
runs-on: ubuntu-latest
container: ghcr.io/cn-docker/hugo:v0.160.1
steps:
- name: Checkout
uses: actions/checkout@v6
with:
submodules: recursive
- name: Build with Hugo
run: task build ENV=production
- name: Upload the built site
uses: actions/upload-artifact@v7
with:
name: "site-built-${{ env.TARGET_REPO_NAME }}"
path: public
retention-days: 8
publish:
needs: build
environment: production
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v6
with:
submodules: recursive
- name: Download the built site
uses: actions/download-artifact@v8
with:
name: "site-built-${{ env.TARGET_REPO_NAME }}"
path: public
- name: Publish site
uses: cpina/github-action-push-to-another-repository@v1.7.3
env:
SSH_DEPLOY_KEY: ${{ secrets.SSH_PROD_DEPLOY_KEY }}
with:
source-directory: ./public
destination-github-username: learn-software-engineering
destination-repository-name: ${{ env.TARGET_REPO_NAME }}
target-branch: main
target-directory: docs
commit-message: Publish revision ${{ github.sha }}
user-email: learn.software.eng@gmail.com
index-now:
needs: publish
runs-on: ubuntu-latest
container: ghcr.io/cn-docker/hugo:v0.160.1
steps:
- name: Checkout
uses: actions/checkout@v6
with:
submodules: recursive
- name: Download the built site
uses: actions/download-artifact@v8
with:
name: "site-built-${{ env.TARGET_REPO_NAME }}"
path: public
- name: Submit URLs to IndexNow
env:
SITE_URL: ${{ env.SITE_URL }}
API_KEY: ${{ env.INDEXNOW_KEY }}
run: task submit-index-now