mirror of
https://github.com/ditatompel/insights.git
synced 2025-01-08 03:12:06 +07:00
chore: Update workflows (adding staging)
This commit is contained in:
parent
bb9667440f
commit
8822570740
2 changed files with 68 additions and 7 deletions
|
@ -1,7 +1,6 @@
|
||||||
name: Deploy to VPS
|
name: Production
|
||||||
|
|
||||||
on:
|
on:
|
||||||
# auto deploy when pushing to specified branches.
|
|
||||||
push:
|
push:
|
||||||
branches:
|
branches:
|
||||||
- main
|
- main
|
||||||
|
@ -10,14 +9,14 @@ on:
|
||||||
workflow_dispatch:
|
workflow_dispatch:
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
publish:
|
deploy:
|
||||||
|
name: Build and copy to production server
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
if: github.repository_owner == 'ditatompel'
|
if: github.repository_owner == 'ditatompel'
|
||||||
environment: production
|
environment: production
|
||||||
permissions:
|
permissions:
|
||||||
contents: read
|
contents: read
|
||||||
deployments: write
|
deployments: write
|
||||||
name: Build and copy to VPS
|
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
|
@ -55,10 +54,8 @@ jobs:
|
||||||
|
|
||||||
- name: Build
|
- name: Build
|
||||||
run: hugo --minify --gc --enableGitInfo --cleanDestinationDir
|
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
|
- name: Deploy
|
||||||
uses: burnett01/rsync-deployments@5.2
|
uses: burnett01/rsync-deployments@5.2
|
||||||
with:
|
with:
|
||||||
switches: -avzr --quiet --delete
|
switches: -avzr --quiet --delete
|
64
.github/workflows/staging.yaml
vendored
Normal file
64
.github/workflows/staging.yaml
vendored
Normal file
|
@ -0,0 +1,64 @@
|
||||||
|
name: Staging
|
||||||
|
|
||||||
|
on:
|
||||||
|
pull_request:
|
||||||
|
|
||||||
|
# allow triggering workflow manually.
|
||||||
|
workflow_dispatch:
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
deploy:
|
||||||
|
name: Build and copy to staging VPS
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
if: github.repository_owner == 'ditatompel'
|
||||||
|
environment: staging
|
||||||
|
permissions:
|
||||||
|
contents: read
|
||||||
|
deployments: write
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: Checkout
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
|
||||||
|
- name: Setup Node
|
||||||
|
uses: actions/setup-node@v4
|
||||||
|
with:
|
||||||
|
node-version: "20"
|
||||||
|
|
||||||
|
- name: Cache dependencies
|
||||||
|
uses: actions/cache@v4
|
||||||
|
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@v3
|
||||||
|
with:
|
||||||
|
hugo-version: "0.126.3"
|
||||||
|
extended: true
|
||||||
|
|
||||||
|
- name: Cache Hugo modules
|
||||||
|
uses: actions/cache@v4
|
||||||
|
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
|
||||||
|
|
||||||
|
- name: Deploy to staging
|
||||||
|
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