Skip to content

Commit c26b184

Browse files
authored
Update website to use SSH
1 parent a03619b commit c26b184

File tree

1 file changed

+12
-32
lines changed

1 file changed

+12
-32
lines changed

.github/workflows/website.yml

Lines changed: 12 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@ on:
66
permissions:
77
contents: read
88
jobs:
9-
build:
10-
name: Build
9+
run:
10+
name: Build & Update Website
1111
if: github.repository == 'EmulatorJS/emulatorjs.org'
1212
runs-on: ubuntu-latest
1313
steps:
@@ -18,36 +18,16 @@ jobs:
1818
git pull
1919
yarn install
2020
yarn build
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-
run:
31-
name: Deploy
32-
needs: build
33-
if: github.repository == 'EmulatorJS/emulatorjs.org'
34-
runs-on: emulatorjs-server
35-
steps:
36-
- name: Download a single artifact
37-
uses: actions/download-artifact@v4
38-
with:
39-
name: website
40-
path: /mnt/HDD/website
41-
- name: Stop Website
21+
- name: Setup SSH
4222
run: |
43-
systemctl stop emulatorjs-org
44-
rm -rf /mnt/HDD/website/emulatorjs.org
45-
- name: Unzip Website
23+
echo "${{secrets.SSH_CDN_PRIVATE_KEY}}" > ~/.ssh/id_rsa
24+
echo "Host ${{ secrets.SSH_HOST }}" > ~/.ssh/config
25+
echo " User ${{ secrets.SSH_CDN_USERNAME }}" >> ~/.ssh/config
26+
echo " IdentityFile ~/.ssh/id_rsa" >> ~/.ssh/config
27+
chmod 600 ~/.ssh/id_rsa
28+
- name: Update Website
4629
run: |
47-
unzip -o /mnt/HDD/website/website.zip -d /mnt/HDD/website/emulatorjs.org
48-
rm /mnt/HDD/website/website.zip
49-
- name: Deploy Website
30+
rsync -Pavz --delete -e "ssh -i $HOME/.ssh/id_rsa" .output/ ${{ secrets.SSH_CDN_USERNAME}}@${{secrets.SSH_HOST}}:/mnt/HDD/website/emulatorjs.org/
31+
- name: Restart Website
5032
run: |
51-
systemctl restart emulatorjs-org
52-
53-
33+
ssh -i $HOME/.ssh/id_rsa ${{ secrets.SSH_CDN_USERNAME }}@${{ secrets.SSH_HOST }} "systemctl restart emulatorjs-org"

0 commit comments

Comments
 (0)