-
Notifications
You must be signed in to change notification settings - Fork 0
37 lines (35 loc) · 1.12 KB
/
deploychals.yaml
File metadata and controls
37 lines (35 loc) · 1.12 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
name: Deploy Chals
on:
push:
branches: [ main ]
paths: [ 'chals/**' ]
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
jobs:
deploy:
name: "Deploy chals to prod"
runs-on: ubuntu-latest
# if: github.event_name == 'push' && github.ref == 'refs/heads/main'
# needs: test
steps:
- name: Configure SSH
run: |
mkdir -p ~/.ssh/
echo "$SSH_KEY" > ~/.ssh/prod.key
chmod 600 ~/.ssh/prod.key
cat >>~/.ssh/config <<END
Host prod
HostName $SSH_HOST
User $SSH_USER
IdentityFile ~/.ssh/prod.key
StrictHostKeyChecking no
END
env:
SSH_USER: ${{ secrets.SSH_USER }}
SSH_KEY: ${{ secrets.SSH_KEY }}
SSH_HOST: ${{ secrets.SSH_HOST }}
- name: Check out the source
run: ssh prod 'cd /opt/fallctf-2025-chal-repo && git fetch && git reset --hard origin/main'
- name: Start the server
if: ${{ always() }}
run: ssh prod 'cd /opt/fallctf-2025-chal-repo && docker compose up -d --build --remove-orphans'