-
Notifications
You must be signed in to change notification settings - Fork 47
75 lines (66 loc) · 1.88 KB
/
build-deploy.yaml
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
name: build-deploy
on:
push:
branches:
- main
jobs:
build:
name: Build and Deploy
runs-on: ubuntu-22.04
environment:
name: prod
url: https://libproxy-db.org/
steps:
- name: Checkout
uses: actions/[email protected]
with:
# Need fetch-depth 0, otherwise a shallow-clone will occur, and we
# won't have history to use with buildinfo.sh.
fetch-depth: 0
- name: Install Hugo
env:
HUGO_VERSION: 0.124.1
run: |
curl \
--silent \
--location \
https://github.com/gohugoio/hugo/releases/download/v${HUGO_VERSION}/hugo_extended_${HUGO_VERSION}_linux-amd64.tar.gz \
| tar \
--extract \
--gunzip \
--directory=/usr/local/bin \
hugo
- name: Build site
run: |
./buildinfo.sh > data/buildinfo.json
hugo
- name: Upload site artifact
uses: actions/[email protected]
with:
name: libproxy-db
path: public
if-no-files-found: error
- name: Set up SSH
run: |
mkdir -p ~/.ssh
echo "${{ secrets.SSH_KNOWN_HOSTS }}" >> ~/.ssh/known_hosts
chmod 700 ~/.ssh
chmod 600 ~/.ssh/known_hosts
- name: Tailscale
uses: tailscale/github-action@v2
with:
oauth-client-id: ${{ secrets.TS_OAUTH_CLIENT_ID }}
oauth-secret: ${{ secrets.TS_OAUTH_SECRET }}
tags: tag:ci
- name: Deploy site
env:
SSH_AUTH_SOCK: /tmp/ssh_agent.sock
run: |
rsync \
--recursive \
--verbose \
--rsh="ssh -l deploy-libproxy -i libproxy-db.org_deploy" \
--copy-links \
--delete \
public/ \
100.77.83.94:/srv/http/libproxy-db.org/