-
Notifications
You must be signed in to change notification settings - Fork 2
66 lines (54 loc) · 1.91 KB
/
deploy.yaml
File metadata and controls
66 lines (54 loc) · 1.91 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
name: Build and Deploy
on:
workflow_dispatch:
push:
branches: [ main ]
permissions: {}
jobs:
build:
runs-on: ubuntu-latest
# These permissions are needed to interact with GitHub's OIDC Token endpoint.
permissions:
id-token: write
contents: read
steps:
- uses: GitHubSecurityLab/actions-permissions/monitor@v1
- name: Checkout
uses: actions/checkout@v4
with:
persist-credentials: false
- name: Set up Ruby
uses: ruby/setup-ruby@b90be12699fdfcbee4440c2bba85f6f460446bb0 # v1.279.0
with:
bundler-cache: true
- name: Install dependencies
run: bundle install
- name: Build site
run: bundle exec jekyll build
- name: Tailscale authenticate
uses: tailscale/github-action@53acf823325fe9ca47f4cdaa951f90b4b0de5bb9 # v4.1.1
with:
oauth-client-id: ${{ secrets.TS_OAUTH_CLIENT_ID }}
oauth-secret: ${{ secrets.TS_OAUTH_SECRET }}
tags: tag:ci
ping: ${{ secrets.K8S_CONTROL_HOST }}
# Tailscale handles authentication
- name: Deploy site files
env:
K8S_CONTROL_USER: ${{ secrets.K8S_CONTROL_USER }}
K8S_CONTROL_HOST: ${{ secrets.K8S_CONTROL_HOST }}
run: |
rsync -avz --delete \
-e "ssh -o StrictHostKeyChecking=accept-new" \
_site/ \
"${K8S_CONTROL_USER}@${K8S_CONTROL_HOST}:/var/www/sites/knowledge-base/"
# Tailscale handles authentication
- name: Restart website
env:
K8S_CONTROL_USER: ${{ secrets.K8S_CONTROL_USER }}
K8S_CONTROL_HOST: ${{ secrets.K8S_CONTROL_HOST }}
run: |
ssh "${K8S_CONTROL_USER}@${K8S_CONTROL_HOST}" "
k3s kubectl -n kb-prod rollout restart deploy/knowledge-base
k3s kubectl -n kb-prod wait --for=condition=available deploy/knowledge-base --timeout=60s
"