Skip to content

Commit 35b3ad0

Browse files
committed
Fix Deploy
1 parent b87b8ff commit 35b3ad0

File tree

1 file changed

+30
-12
lines changed

1 file changed

+30
-12
lines changed

.github/workflows/website.yml

Lines changed: 30 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@ on:
66
permissions:
77
contents: read
88
jobs:
9-
run:
10-
name: Build & Update Website
9+
build:
10+
name: Build
1111
if: github.repository == 'EmulatorJS/emulatorjs.org'
1212
runs-on: ubuntu-latest
1313
steps:
@@ -18,18 +18,36 @@ jobs:
1818
git pull
1919
yarn install
2020
yarn build
21-
- name: Setup SSH
21+
- name: Zip Website
22+
run: |
23+
zip -r website.zip .output/
24+
- name: Upload Website
25+
uses: actions/upload-artifact@v4
26+
with:
27+
name: website
28+
path: website.zip
29+
retention-days: 1
30+
31+
run:
32+
name: Deploy
33+
needs: build
34+
if: github.repository == 'EmulatorJS/emulatorjs.org'
35+
runs-on: emulatorjs-server
36+
steps:
37+
- name: Download Website
38+
uses: actions/download-artifact@v4
39+
with:
40+
name: website
41+
- name: Unzip Website
2242
run: |
23-
mkdir -p ~/.ssh
24-
echo "${{secrets.SSH_CDN_PRIVATE_KEY}}" > ~/.ssh/id_ed25519
25-
echo "Host ${{ secrets.SSH_HOST }}" > ~/.ssh/config
26-
echo " User ${{ secrets.SSH_CDN_USERNAME }}" >> ~/.ssh/config
27-
echo " IdentityFile ~/.ssh/id_ed25519" >> ~/.ssh/config
28-
chmod 600 ~/.ssh/id_ed25519
29-
ssh-keyscan -H ${{ secrets.SSH_HOST }} >> ~/.ssh/known_hosts
43+
unzip -o website.zip -d output/
3044
- name: Update Website
3145
run: |
32-
rsync -az --delete -e "ssh -i ~/.ssh/id_ed25519" .output/ ${{ secrets.SSH_CDN_USERNAME}}@${{secrets.SSH_HOST}}:/mnt/HDD/website/emulatorjs.org/
46+
rsync -az --delete output/.output/ /mnt/HDD/website/emulatorjs.org/
3347
- name: Restart Website
3448
run: |
35-
ssh -i ~/.ssh/id_ed25519 ${{ secrets.SSH_CDN_USERNAME }}@${{ secrets.SSH_HOST }} "systemctl restart emulatorjs-org"
49+
systemctl restart emulatorjs-org
50+
- name: Cleanup
51+
run: |
52+
rm -rf output/
53+
rm -f website.zip

0 commit comments

Comments
 (0)