Skip to content

Commit

Permalink
Merge pull request #35 from michaelclapham/deploy_gha
Browse files Browse the repository at this point in the history
Create deploy.yml
  • Loading branch information
michaelclapham authored Sep 7, 2024
2 parents 025eebc + 45e73e9 commit cb71049
Showing 1 changed file with 60 additions and 0 deletions.
60 changes: 60 additions & 0 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
on:
push:
branches:
- main
- deploy_gha
name: Deploy
jobs:
test:
name: Deploy on merge to main
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/[email protected]
- name: Cache node modules
uses: actions/cache@v1
with:
path: ~/.npm
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-node-
- uses: actions/setup-node@v2
with:
node-version: '20'

- run: npm install

- run: npm run build

- run: sudo apt-get install tree
- run: tree build

- name: Upload site files
uses: appleboy/[email protected]
with:
host: ${{ secrets.SSH_HOST }}
username: ${{ secrets.SSH_USERNAME }}
password: ${{ secrets.SSH_PASSWORD }}
port: ${{ secrets.SSH_PORT }}
source: "build"
target: /var/www/qrsync/tmp
overwrite: true

- name: Move site files from tmp folder
uses: appleboy/[email protected]
with:
host: ${{ secrets.SSH_HOST }}
username: ${{ secrets.SSH_USERNAME }}
password: ${{ secrets.SSH_PASSWORD }}
port: ${{ secrets.SSH_PORT }}
script: cp -a /var/www/qrsync/tmp/build/. /var/www/qrsync

- name: Remove tmp folder
uses: appleboy/[email protected]
with:
host: ${{ secrets.SSH_HOST }}
username: ${{ secrets.SSH_USERNAME }}
password: ${{ secrets.SSH_PASSWORD }}
port: ${{ secrets.SSH_PORT }}
script: rm -rf /var/www/qrsync/tmp

0 comments on commit cb71049

Please sign in to comment.