Repository navigation
58 lines (49 loc) · 1.74 KB
/
Copy pathdeploy_opencode.yml
File metadata and controls
58 lines (49 loc) · 1.74 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
name: Deploy OpenCode Fork OTA
on:
workflow_dispatch: # 수동 트리거 전용
jobs:
test:
name: Run Automated Tests
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Setup Bun
uses: oven-sh/setup-bun@v1
with:
bun-version: 1.3.14
- name: Install dependencies
run: bun install
- name: Run Tests
run: bun test --cwd packages/opencode
build-and-deploy:
name: Package ZIP and Deploy
needs: test
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Zip OpenCode Mod
run: |
mkdir -p dist_ota
# Exclude heavy node_modules to save space and upload time
zip -r dist_ota/opencode_mod_ota_v${{ github.run_number }}.zip . -x "*node_modules*" -x "*.git*"
- name: Deploy to Oracle Server via SCP
uses: appleboy/scp-action@v0.1.7
with:
host: ${{ secrets.ORACLE_HOST }}
username: ${{ secrets.ORACLE_USERNAME }}
key: ${{ secrets.ORACLE_SSH_KEY }}
source: "dist_ota/*"
target: "/var/www/ota/downloads"
strip_components: 1
- name: Create Symlinks and Auto-Cleanup
uses: appleboy/ssh-action@v1.0.3
with:
host: ${{ secrets.ORACLE_HOST }}
username: ${{ secrets.ORACLE_USERNAME }}
key: ${{ secrets.ORACLE_SSH_KEY }}
script: |
cd /var/www/ota/downloads
ln -sf opencode_mod_ota_v${{ github.run_number }}.zip opencode_mod_ota.zip
ls -tp opencode_mod_ota_v*.zip | grep -v '/$' | tail -n +6 | xargs -I {} rm -- {} 2>/dev/null || true
echo "OpenCode OTA deployed and old versions cleaned!"