split workflow into build and deploy
This commit is contained in:
parent
3a41709d1c
commit
17569bdcd4
1 changed files with 22 additions and 17 deletions
|
|
@ -1,4 +1,4 @@
|
||||||
name: Build Hugo Site
|
name: Build and Deploy Hugo Site
|
||||||
|
|
||||||
on:
|
on:
|
||||||
push:
|
push:
|
||||||
|
|
@ -8,7 +8,6 @@ on:
|
||||||
jobs:
|
jobs:
|
||||||
build:
|
build:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v2.4.0
|
- uses: actions/checkout@v2.4.0
|
||||||
|
|
||||||
|
|
@ -29,7 +28,7 @@ jobs:
|
||||||
uses: actions/setup-node@v4.0.2
|
uses: actions/setup-node@v4.0.2
|
||||||
with:
|
with:
|
||||||
node-version: '20'
|
node-version: '20'
|
||||||
cache: 'npm' # caching npm dependencies
|
cache: 'npm'
|
||||||
|
|
||||||
- name: Cache Node modules
|
- name: Cache Node modules
|
||||||
uses: actions/cache@v3
|
uses: actions/cache@v3
|
||||||
|
|
@ -48,27 +47,33 @@ jobs:
|
||||||
uses: peaceiris/actions-hugo@v3.0.0
|
uses: peaceiris/actions-hugo@v3.0.0
|
||||||
with:
|
with:
|
||||||
hugo-version: '0.121.2'
|
hugo-version: '0.121.2'
|
||||||
extended: true # Specify to use Hugo Extended version
|
extended: true
|
||||||
|
|
||||||
- name: Cache Hugo modules
|
|
||||||
uses: actions/cache@v3
|
|
||||||
with:
|
|
||||||
path: |
|
|
||||||
resources
|
|
||||||
public
|
|
||||||
key: ${{ runner.os }}-hugo-${{ hashFiles('**/go.sum', '**/package-lock.json') }}
|
|
||||||
restore-keys: |
|
|
||||||
${{ runner.os }}-hugo-
|
|
||||||
|
|
||||||
- name: Build Hugo site
|
- name: Build Hugo site
|
||||||
run: hugo --minify
|
run: hugo --minify
|
||||||
|
|
||||||
- name: test deployment via FTP
|
- name: Upload Artifacts
|
||||||
|
uses: actions/upload-artifact@v2
|
||||||
|
with:
|
||||||
|
name: hugo-site
|
||||||
|
path: public/
|
||||||
|
|
||||||
|
deploy:
|
||||||
|
needs: build
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- name: Download Artifacts
|
||||||
|
uses: actions/download-artifact@v2
|
||||||
|
with:
|
||||||
|
name: hugo-site
|
||||||
|
path: public
|
||||||
|
|
||||||
|
- name: Deploy to Server
|
||||||
uses: SamKirkland/FTP-Deploy-Action@4.0.0
|
uses: SamKirkland/FTP-Deploy-Action@4.0.0
|
||||||
with:
|
with:
|
||||||
protocol: ftps # Ensure to use FTPS
|
protocol: ftps
|
||||||
server: ${{ secrets.FTP_SERVER }}
|
server: ${{ secrets.FTP_SERVER }}
|
||||||
username: ${{ secrets.FTP_USERNAME }}
|
username: ${{ secrets.FTP_USERNAME }}
|
||||||
password: ${{ secrets.FTP_PASSWORD }}
|
password: ${{ secrets.FTP_PASSWORD }}
|
||||||
local-dir: 'public/'
|
local-dir: public/
|
||||||
server-dir: '/'
|
server-dir: '/'
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue