Refactor workflow to use toml-action for environment settings in pipeline-test.yaml.
All checks were successful
Build and Deploy Hugo Site / build_and_deploy (push) Successful in 18s
All checks were successful
Build and Deploy Hugo Site / build_and_deploy (push) Successful in 18s
This commit is contained in:
parent
66804eb88c
commit
739c7a4365
1 changed files with 62 additions and 41 deletions
|
|
@ -11,53 +11,60 @@ jobs:
|
|||
steps:
|
||||
- uses: actions/checkout@v2.4.0
|
||||
|
||||
- name: env-yaml-file
|
||||
uses: pietrobolcato/action-read-yaml@main
|
||||
id: read_action_js
|
||||
# - name: env-yaml-file
|
||||
# uses: pietrobolcato/action-read-yaml@main
|
||||
# id: read_action_js
|
||||
# with:
|
||||
# config: ${{ github.workspace }}/deploy_env.yaml
|
||||
# env-var-prefix: myEnv
|
||||
|
||||
- name: env-toml-file
|
||||
uses: SebRollen/toml-action@v1.2.0
|
||||
id: read_toml
|
||||
with:
|
||||
config: ${{ github.workspace }}/deploy_env.yaml
|
||||
env-var-prefix: myEnv
|
||||
file: 'hugo.toml'
|
||||
field: 'environment'
|
||||
|
||||
- name: Set up Go
|
||||
uses: actions/setup-go@v5.0.0
|
||||
with:
|
||||
go-version: '1.20.5'
|
||||
# - name: Set up Go
|
||||
# uses: actions/setup-go@v5.0.0
|
||||
# with:
|
||||
# go-version: '1.20.5'
|
||||
|
||||
- name: Cache Go modules
|
||||
uses: actions/cache@v3
|
||||
with:
|
||||
path: ~/go/pkg/mod
|
||||
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
|
||||
restore-keys: |
|
||||
${{ runner.os }}-go-
|
||||
# - name: Cache Go modules
|
||||
# uses: actions/cache@v3
|
||||
# with:
|
||||
# path: ~/go/pkg/mod
|
||||
# key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
|
||||
# restore-keys: |
|
||||
# ${{ runner.os }}-go-
|
||||
|
||||
- name: Set up Node.js
|
||||
uses: actions/setup-node@v4.0.2
|
||||
with:
|
||||
node-version: '20'
|
||||
cache: 'npm'
|
||||
# - name: Set up Node.js
|
||||
# uses: actions/setup-node@v4.0.2
|
||||
# with:
|
||||
# node-version: '20'
|
||||
# cache: 'npm'
|
||||
|
||||
- name: Cache Node modules
|
||||
uses: actions/cache@v3
|
||||
with:
|
||||
path: ~/.npm
|
||||
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
|
||||
restore-keys: |
|
||||
${{ runner.os }}-node-
|
||||
# - name: Cache Node modules
|
||||
# uses: actions/cache@v3
|
||||
# with:
|
||||
# path: ~/.npm
|
||||
# key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
|
||||
# restore-keys: |
|
||||
# ${{ runner.os }}-node-
|
||||
|
||||
- name: Install PostCSS
|
||||
run: |
|
||||
npm install -g postcss postcss-cli
|
||||
npm install autoprefixer
|
||||
# - name: Install PostCSS
|
||||
# run: |
|
||||
# npm install -g postcss postcss-cli
|
||||
# npm install autoprefixer
|
||||
|
||||
- name: Set up Hugo Extended
|
||||
uses: peaceiris/actions-hugo@v3.0.0
|
||||
with:
|
||||
hugo-version: '0.121.2'
|
||||
extended: true
|
||||
# - name: Set up Hugo Extended
|
||||
# uses: peaceiris/actions-hugo@v3.0.0
|
||||
# with:
|
||||
# hugo-version: '0.121.2'
|
||||
# extended: true
|
||||
|
||||
- name: Build Hugo site
|
||||
run: hugo --minify
|
||||
# - name: Build Hugo site
|
||||
# run: hugo --minify
|
||||
|
||||
- name: Setup rsync
|
||||
run: apt-get update && apt-get install -y rsync
|
||||
|
|
@ -68,15 +75,29 @@ jobs:
|
|||
ssh-private-key: ${{ secrets.VFO_SSH_KEY }}
|
||||
|
||||
- name: Deploy to Development
|
||||
if: env.myEnv_env == 'development'
|
||||
if: steps.read_toml.outputs.environment == 'development'
|
||||
run: |
|
||||
rsync -avz --delete ./public/ verua.info@verua.info:/preview.verua.info/
|
||||
env:
|
||||
RSYNC_RSH: 'ssh -p 2121 -o StrictHostKeyChecking=no'
|
||||
|
||||
- name: Deploy to Production
|
||||
if: env.myEnv_env == 'production'
|
||||
if: steps.read_toml.outputs.environment == 'production'
|
||||
run: |
|
||||
rsync -avz --delete ./public/ verua.info@verua.info:/httpdocs/
|
||||
env:
|
||||
RSYNC_RSH: 'ssh -p 2121 -o StrictHostKeyChecking=no'
|
||||
|
||||
# - name: Deploy to Development
|
||||
# if: env.myEnv_env == 'development'
|
||||
# run: |
|
||||
# rsync -avz --delete ./public/ verua.info@verua.info:/preview.verua.info/
|
||||
# env:
|
||||
# RSYNC_RSH: 'ssh -p 2121 -o StrictHostKeyChecking=no'
|
||||
|
||||
# - name: Deploy to Production
|
||||
# if: env.myEnv_env == 'production'
|
||||
# run: |
|
||||
# rsync -avz --delete ./public/ verua.info@verua.info:/httpdocs/
|
||||
# env:
|
||||
# RSYNC_RSH: 'ssh -p 2121 -o StrictHostKeyChecking=no'
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue