-
Notifications
You must be signed in to change notification settings - Fork 0
73 lines (58 loc) · 1.89 KB
/
deploy_v2.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
name: Deploy v2
on:
push:
branches:
- schism
workflow_dispatch:
jobs:
build-and-deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Install Mold Linker
uses: rui314/setup-mold@v1
- name: Install Rust
uses: actions-rs/toolchain@v1
with:
toolchain: nightly
- name: Install sccache
uses: mozilla-actions/sccache-action@v0.0.3
- name: Install nushell
uses: hustcer/setup-nu@v3.8
with:
version: "*"
- name: Setup Rust Cache
id: rust-cache
uses: actions/cache@v3
with:
key: ${{ runner.os }}-rust-cache
path: |
~/.cargo/registry
~/.cargo/git
target
- name: Pre-build GHA Scripts
run: |
echo RUSTC_WRAPPER=sccache >> $GITHUB_ENV
echo SCCACHE_GHA_ENABLED=true >> $GITHUB_ENV
sudo ln -s /usr/local/bin/mold /usr/bin/mold
echo "${{ secrets.DOTENV_V2 }}" > .env
sccache --show-stats
- name: Run build script
run: |
nu scripts/build.nu --release
- name: Login to docker hub
run: docker login -u onlycs -p ${{ secrets.DOCKER_PASSWORD }}
- name: Build and push dockerfiles
run: docker compose build --push
- name: Save ssh keys
run: |
echo "${{ secrets.SSH_KEY }}" > ssh_key
chmod 600 ssh_key
echo "DO_SSH=ssh -i ssh_key onlycs@${{ secrets.SSH_HOST }} -p 22 -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -o LogLevel=ERROR" >> $GITHUB_ENV
- name: Kill and remove old docker container
continue-on-error: true
run: |
$DO_SSH "cd ~/.oreo2; docker compose down"
- name: Save and run compose
continue-on-error: true
run: $DO_SSH "cd ~/.oreo2; docker compose up --pull always -d"