A fork of pds-dash for selfhosted.social
1name: Deploy
2
3on:
4 push:
5 branches:
6 - main
7 - astra/ci
8
9jobs:
10 deploy:
11 name: Deploy
12 runs-on: ubuntu-latest
13
14 steps:
15 - name: Checkout main repo
16 uses: actions/checkout@v4
17
18 - name: Checkout overrides repo
19 uses: actions/checkout@v4
20 with:
21 repository: scientific-witchery/pds-dash-overrides
22 token: ${{ secrets.OVERRIDES_TOKEN}}
23 path: overrides
24
25 - name: Copy config file to root
26 run: cp overrides/config.ts ./config.ts
27
28 - name: Setup Node.js
29 uses: actions/setup-node@v3
30 with:
31 node-version: "20"
32
33 - name: Setup Deno
34 uses: https://github.com/denoland/setup-deno@v2
35
36 - name: Install dependencies
37 run: deno install
38
39 - name: Build project
40 run: deno task build
41
42 - name: Setup SSH
43 run: |
44 mkdir -p ~/.ssh
45 echo "${{ secrets.SSH_PRIVATE_KEY }}" > ~/.ssh/id_ed25519
46 chmod 600 ~/.ssh/id_ed25519
47 cat > ~/.ssh/config << EOF
48 Host deploy
49 HostName ${{ vars.SERVER_HOST }}
50 User ${{ vars.SERVER_USER }}
51 IdentityFile ~/.ssh/id_ed25519
52 StrictHostKeyChecking accept-new
53 BatchMode yes
54 PasswordAuthentication no
55 PubkeyAuthentication yes
56 EOF
57 chmod 600 ~/.ssh/config
58 ssh-keyscan -H ${{ vars.SERVER_HOST }} >> ~/.ssh/known_hosts
59 echo "Deploying to ${{ vars.SERVER_HOST }} as ${{ vars.SERVER_USER }} to /var/www/pds/${{ github.ref_name }}"
60
61 - name: Debug SSH Connection
62 run: ssh -v deploy echo "SSH Connection Successful"
63
64 - name: Create folder if not exists
65 run: ssh deploy "mkdir -p /var/www/pds/${{ github.ref_name }}"
66
67 - name: Deploy via SCP
68 run: scp -r ./dist/* deploy:/var/www/pds/${{ github.ref_name }}