From 74461d37e1182158143ae8a77a01153cfda9c591 Mon Sep 17 00:00:00 2001 From: thomasabishop Date: Tue, 8 Jul 2025 14:30:52 +0100 Subject: [PATCH] infra: create Forgejo deployment action --- .forgejo/workflows/publish_site.yaml | 45 ++++++++++++++++++++++++++++ 1 file changed, 45 insertions(+) create mode 100644 .forgejo/workflows/publish_site.yaml diff --git a/.forgejo/workflows/publish_site.yaml b/.forgejo/workflows/publish_site.yaml new file mode 100644 index 0000000..e4f0d30 --- /dev/null +++ b/.forgejo/workflows/publish_site.yaml @@ -0,0 +1,45 @@ +name: Deploy Site +on: + push: + branches: [main] + +jobs: + deploy: + runs-on: ubuntu-latest + steps: + - name: Checkout code + uses: actions/checkout@v3 + + - name: Setup Node.js + uses: actions/setup-node@v3 + with: + node-version: "18" + cache: "npm" + + - name: Install dependencies + run: npm install + + - name: Build posts + run: npm run build:posts + + - name: Build project + run: npm run build + + - name: Deploy to VPS + uses: appleboy/ssh-action@v0.1.5 + with: + host: localhost # or localhost if connecting from the same VPS + username: ${{ secrets.VPS_USERNAME }} + key: ${{ secrets.VPS_SSH_KEY }} + script: | + rm -rf /var/www/systemsobscure.blog/* + + - name: Copy files to VPS + uses: appleboy/scp-action@v0.1.4 + with: + host: localhost # or localhost + username: ${{ secrets.VPS_USERNAME }} + key: ${{ secrets.VPS_SSH_KEY }} + source: "dist/*" + target: "/var/www/systemsobscure.blog/" + strip_components: 1