-
Notifications
You must be signed in to change notification settings - Fork 1
54 lines (42 loc) · 1.43 KB
/
build-and-deploy.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
name: Build and Deploy
on:
# Runs only when master is updated
push:
branches: [ "master" ]
# Allows manually running this workflow from the Actions Tab
workflow_dispatch:
# Allow only one concurrent deployment, skips runs queued between the current
# run and latest queued. We don't cancel in progress to allow for the current
# run to finish deploying to production.
concurrency:
group: "production"
cancel-in-progress: false
jobs:
build_and_deploy:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Cache Docker layers
uses: actions/cache@v3
with:
path: /tmp/.buildx-cache
key: ${{ runner.os }}-buildx-${{ github.sha }}
restore-keys: |
${{ runner.os }}-buildx-
- name: Build with Docker
run: docker compose up --build
- name: Setup SSH keys
run: |
mkdir -p ~/.ssh
echo '${{ secrets.SSH_PRIV_KEY }}' > ~/.ssh/id_ed25519
chmod 400 ~/.ssh/id_ed25519
echo '${{ secrets.SSH_HOST_KEY }}' > ~/.ssh/known_hosts
chmod 400 ~/.ssh/known_hosts
- name: Deploy with rsync
run: |
rsync --archive --verbose --compress --partial --checksum --progress \
--human-readable --delete --exclude=static --exclude=archives \
_site/ decal@ssh.ocf.berkeley.edu:/home/d/de/decal/public_html