-
Notifications
You must be signed in to change notification settings - Fork 0
70 lines (51 loc) · 1.45 KB
/
Copy pathdeploy.yml
File metadata and controls
70 lines (51 loc) · 1.45 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
67
68
69
name: Deploy on VPS
on:
push:
tags:
# v1.2.3
# v1.2.3-testing
- v[0-9]+.[0-9]+.[0-9]+*
concurrency:
group: 'quantum'
cancel-in-progress: false
jobs:
publish:
uses: docker/github-builder/.github/workflows/build.yml@v1
permissions:
contents: read
id-token: write
packages: write
with:
output: image
push: true
file: .github/Dockerfile
platforms: |
linux/amd64
linux/arm64
meta-images: ghcr.io/skohtv/quantum
meta-tags: |
latest
secrets:
registry-auths: |
- registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
deploy:
name: Deploy on VPS
runs-on: ubuntu-latest
needs: publish
steps:
- name: Add ssh keys
run: |
install -m 600 -D /dev/null ~/.ssh/id_rsa
echo "${{ secrets.SSH_PRIVATE_KEY }}" > ~/.ssh/id_rsa
ssh-keyscan -H ${{ secrets.SSH_HOST }} > ~/.ssh/known_hosts
- name: Connect and redeploy
run: |
ssh ${{ secrets.SSH_USER }}@${{ secrets.SSH_HOST }} "\
(docker kill quantum || true) &&\
(docker rm quantum || true) &&\
docker pull ghcr.io/skohtv/quantum:latest &&\
docker run --env-file .quantum.env --name quantum --detach ghcr.io/skohtv/quantum:latest"
- name: Cleanup
run: rm -rf ~/.ssh