-
Notifications
You must be signed in to change notification settings - Fork 0
107 lines (102 loc) · 3.21 KB
/
ci.yml
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
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
name: Build eMoflon website
on:
push:
# Run pipeline for commits on branch 'main' and on 'testing/<stuff>'
branches:
- main
- 'testing/**'
- 'feature/**'
- 'hotfix/**'
env:
# Hugo version to use
VERSION: "0.134.2"
# Hugo release source
HUGO_RELEASE_SRC: "https://github.com/gohugoio/hugo/releases"
jobs:
hugo-build:
runs-on: [ubuntu-20.04]
steps:
- name: Install Hugo
run: |
export HUGO_DEB_FILE=hugo_extended_${VERSION}_linux-amd64.deb
echo "Using URL: $HUGO_RELEASE_SRC/download/v$VERSION/$HUGO_DEB_FILE"
wget -q $HUGO_RELEASE_SRC/download/v$VERSION/$HUGO_DEB_FILE
sudo dpkg -i $HUGO_DEB_FILE
- name: Check out repository code
uses: actions/checkout@v4
with:
submodules: 'recursive'
- name: Build production site
run: |
hugo
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: public-prod
path: public/
- name: Build draft site
run: |
rm -rf public/*
hugo -D
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: public-draft
path: public/
check-urls-prod:
needs: [hugo-build]
runs-on: [ubuntu-20.04]
steps:
- name: Check out repository code
uses: actions/checkout@v4
- name: Download Hugo build
uses: actions/download-artifact@v4
with:
name: public-prod
path: public
- name: Docker setup
run: |
docker pull wjdp/htmltest:latest
- name: Run htmltest
run: |
docker run --rm -v $PWD:/test wjdp/htmltest:latest -c /test/.htmltest.yml /test/public
deploy-prod:
needs: [hugo-build, check-urls-prod]
runs-on: [ubuntu-20.04]
# Skip deploy job if branch is 'main'
if: ${{ github.ref == 'refs/heads/main' }}
steps:
- name: Download Hugo build
uses: actions/download-artifact@v4
with:
name: public-prod
- name: Push build artifacts to deployment repository
uses: cpina/github-action-push-to-another-repository@main
env:
SSH_DEPLOY_KEY: ${{ secrets.SSH_DEPLOY_KEY_PROD }}
with:
source-directory: '.'
destination-github-username: 'eMoflon'
destination-repository-name: 'eMoflon.github.io'
user-email: [email protected]
target-branch: master
deploy-testing:
needs: [hugo-build]
runs-on: [ubuntu-20.04]
# Skip deploy job if branch is 'testing/deploy'
if: ${{ github.ref == 'refs/heads/testing/deploy' }}
steps:
- name: Download Hugo build
uses: actions/download-artifact@v4
with:
name: public-draft
- name: Push build artifacts to deployment repository
uses: cpina/github-action-push-to-another-repository@main
env:
SSH_DEPLOY_KEY: ${{ secrets.SSH_DEPLOY_KEY }}
with:
source-directory: '.'
destination-github-username: 'maxkratz'
destination-repository-name: 'emoflon-website-deploy'
user-email: [email protected]
target-branch: testing