mirror of
https://github.com/ditatompel/insights.git
synced 2025-01-08 03:12:06 +07:00
Merge pull request #37 from ditatompel/core-update
feat: Adding deploy to vps GitHub workflow
This commit is contained in:
commit
f6e8f55313
1 changed files with 67 additions and 0 deletions
67
.github/workflows/deploy-to-vps.yaml
vendored
Normal file
67
.github/workflows/deploy-to-vps.yaml
vendored
Normal file
|
@ -0,0 +1,67 @@
|
|||
name: Deploy to VPS
|
||||
|
||||
on:
|
||||
# auto deploy when pushing to specified branches.
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
|
||||
# allow triggering workflow manually.
|
||||
workflow_dispatch:
|
||||
|
||||
jobs:
|
||||
publish:
|
||||
runs-on: ubuntu-latest
|
||||
permissions:
|
||||
contents: read
|
||||
deployments: write
|
||||
name: Build and copy to VPS
|
||||
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v3
|
||||
|
||||
- name: Setup Node
|
||||
uses: actions/setup-node@v3
|
||||
with:
|
||||
node-version: "19"
|
||||
|
||||
- name: Cache dependencies
|
||||
uses: actions/cache@v3
|
||||
with:
|
||||
path: ~/.npm
|
||||
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
|
||||
restore-keys: |
|
||||
${{ runner.os }}-node-
|
||||
|
||||
- name: Install dependencies
|
||||
run: npm ci
|
||||
|
||||
- name: Setup Hugo
|
||||
uses: peaceiris/actions-hugo@v2
|
||||
with:
|
||||
hugo-version: "latest"
|
||||
extended: true
|
||||
|
||||
- name: Cache Hugo modules
|
||||
uses: actions/cache@v3
|
||||
with:
|
||||
path: /tmp/hugo_cache
|
||||
key: ${{ runner.os }}-hugomod-${{ hashFiles('**/go.sum') }}
|
||||
restore-keys: |
|
||||
${{ runner.os }}-hugomod-
|
||||
|
||||
- name: Build
|
||||
run: hugo --minify --gc --enableGitInfo --cleanDestinationDir
|
||||
# Use following instead if defaultContentLanguageInSubdir is enabled.
|
||||
# run: hugo --minify --gc --enableGitInfo --cleanDestinationDir && cp public/en/404.html public/404.html
|
||||
|
||||
- name: Deploy website with rsync
|
||||
uses: burnett01/rsync-deployments@5.2
|
||||
with:
|
||||
switches: -avzr --quiet --delete
|
||||
path: public/
|
||||
remote_path: ${{ secrets.DEPLOY_PATH }}
|
||||
remote_host: ${{ secrets.DEPLOY_HOST }}
|
||||
remote_user: ${{ secrets.DEPLOY_USER }}
|
||||
remote_key: ${{ secrets.DEPLOY_KEY }}
|
Loading…
Reference in a new issue