40 lines
1.5 KiB
YAML
40 lines
1.5 KiB
YAML
name: Deploy Blog
|
|
on:
|
|
push:
|
|
branches: [main]
|
|
jobs:
|
|
deploy:
|
|
runs-on: ubuntu-latest
|
|
container: node:18
|
|
steps:
|
|
- uses: actions/checkout@v3
|
|
- run: npm install
|
|
- run: npm run build:posts
|
|
- run: npm run build
|
|
env:
|
|
VITE_EOLAS_API_URL: ${{ vars.EOLAS_API_ENDPOINT }}
|
|
VITE_EOLAS_API_KEY: ${{ secrets.EOLAS_API_KEY }}
|
|
VITE_WAKAPI_URL: ${{ vars.WAKAPI_URL }}
|
|
VITE_WAKAPI_TOKEN: ${{ secrets.WAKAPI_TOKEN }}
|
|
- run: |
|
|
- run: |
|
|
echo "${{ secrets.VPS_DEPLOY_USER_SSH_KEY }}" > /tmp/ssh_key
|
|
chmod 600 /tmp/ssh_key
|
|
ssh -i /tmp/ssh_key -o StrictHostKeyChecking=no ${{ vars.VPS_DEPLOY_USER }} "bash -c 'rm -rf /var/www/systemsobscure.blog/*'"
|
|
scp -i /tmp/ssh_key -o StrictHostKeyChecking=no -r dist/* ${{ vars.VPS_DEPLOY_USER }}:/var/www/systemsobscure.blog/
|
|
rm /tmp/ssh_key
|
|
- name: Notify success
|
|
if: success()
|
|
run: |
|
|
curl -u thomas:${{ secrets.NTFY_PASSWORD }} \
|
|
-H "Tags: Forgejo Runner" \
|
|
-d "🟩 systemsobscure.blog successfully deployed" \
|
|
https://ntfy.systemsobscure.net/sysobs
|
|
|
|
- name: Notify failure
|
|
if: failure()
|
|
run: |
|
|
curl -u thomas:${{ secrets.NTFY_PASSWORD }} \
|
|
-H "Tags: Forgejo Runner" \
|
|
-d "🟥 systemsobscure.blog deployment failed. See Forgejo Action logs." \
|
|
https://ntfy.systemsobscure.net/sysobs
|