Skip to content

Commit 90e7437

Browse files
committed
Deploy to production
1 parent 108d0d8 commit 90e7437

1 file changed

Lines changed: 59 additions & 0 deletions

File tree

.github/workflows/deploy-prod.yml

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
name: Deploy to Production Environment
2+
3+
on:
4+
# Can be triggered manually
5+
workflow_dispatch:
6+
# Runs every Monday at 00:00 UTC
7+
schedule:
8+
- cron: '0 0 * * 1'
9+
10+
env:
11+
ENV: production
12+
TARGET_REPO_NAME: learn-software-engineering.github.io
13+
14+
jobs:
15+
spell-checker:
16+
runs-on: ubuntu-latest
17+
container: ghcr.io/cn-writing/cspell
18+
steps:
19+
- name: Checkout
20+
uses: actions/checkout@v4
21+
- name: CSpell English
22+
run: make spell-check
23+
build:
24+
runs-on: ubuntu-latest
25+
container: ghcr.io/cn-writing/hugo
26+
steps:
27+
- name: Checkout
28+
uses: actions/checkout@v4
29+
with:
30+
submodules: recursive
31+
- name: Build with Hugo
32+
run: make build env=production
33+
- name: Upload the built site
34+
uses: actions/upload-artifact@v4
35+
with:
36+
name: "site-built-${{ env.TARGET_REPO_NAME }}"
37+
path: public
38+
retention-days: 8
39+
publish:
40+
runs-on: ubuntu-latest
41+
needs: build
42+
steps:
43+
- name: Download the built site
44+
uses: actions/download-artifact@v4
45+
with:
46+
name: "site-built-${{ env.TARGET_REPO_NAME }}"
47+
path: public
48+
- name: Publish site
49+
uses: cpina/github-action-push-to-another-repository@v1.7.2
50+
env:
51+
SSH_DEPLOY_KEY: ${{ secrets.SSH_PROD_DEPLOY_KEY }}
52+
with:
53+
source-directory: ./public
54+
destination-github-username: learn-software-engineering
55+
destination-repository-name: ${{ env.TARGET_REPO_NAME }}
56+
target-branch: main
57+
target-directory: docs
58+
commit-message: Publish revision ${{ github.sha }}
59+
user-email: learn.software.eng@gmail.com

0 commit comments

Comments
 (0)