read YAML file for environment variable, and update deployment conditions in pipeline-test.yaml.
Some checks reported warnings
Build and Deploy Hugo Site / build_and_deploy (push) Has been cancelled
Some checks reported warnings
Build and Deploy Hugo Site / build_and_deploy (push) Has been cancelled
This commit is contained in:
parent
12ed432253
commit
18f4bf0496
2 changed files with 8 additions and 51 deletions
|
|
@ -10,28 +10,14 @@ jobs:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v2.4.0
|
- uses: actions/checkout@v2.4.0
|
||||||
- name: Set Environment
|
|
||||||
id: set-env
|
|
||||||
run: |
|
|
||||||
# Ensure the deploy_env.json file exists and is readable
|
|
||||||
if [ ! -f deploy_env.json ]; then
|
|
||||||
echo "deploy_env.json does not exist or cannot be read."
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Extract the environment variable using jq and check if it's empty
|
- name: env-yaml-file
|
||||||
ENV=$(cat deploy_env.json | jq -r '.env')
|
uses: pietrobolcato/action-read-yaml@main
|
||||||
if [ -z "$ENV" ]; then
|
id: read_action_js
|
||||||
echo "Environment variable is empty."
|
with:
|
||||||
exit 1
|
config: ${{ github.workspace }}/deploy_env.yaml
|
||||||
fi
|
env-var-prefix: myEnv
|
||||||
|
|
||||||
# Use GitHub's environment file syntax to set the ENV variable
|
|
||||||
echo "ENV=$ENV" >> $GITHUB_ENV
|
|
||||||
|
|
||||||
# Output the environment variable for use in subsequent steps
|
|
||||||
echo "::set-output name=environment::$ENV"
|
|
||||||
|
|
||||||
- name: Set up Go
|
- name: Set up Go
|
||||||
uses: actions/setup-go@v5.0.0
|
uses: actions/setup-go@v5.0.0
|
||||||
with:
|
with:
|
||||||
|
|
@ -74,7 +60,7 @@ jobs:
|
||||||
run: hugo --minify
|
run: hugo --minify
|
||||||
|
|
||||||
- name: Deploy to Server
|
- name: Deploy to Server
|
||||||
if: ${{ github.job.outputs.environment == 'development' }}
|
if: $myEnv_environment_name == 'development'
|
||||||
uses: SamKirkland/FTP-Deploy-Action@4.0.0
|
uses: SamKirkland/FTP-Deploy-Action@4.0.0
|
||||||
with:
|
with:
|
||||||
protocol: ftps
|
protocol: ftps
|
||||||
|
|
|
||||||
|
|
@ -1,29 +0,0 @@
|
||||||
name: helpers-read-yaml
|
|
||||||
|
|
||||||
on:
|
|
||||||
push:
|
|
||||||
workflow_dispatch:
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
read-yaml:
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
steps:
|
|
||||||
- name: checkout
|
|
||||||
uses: actions/checkout@v3
|
|
||||||
|
|
||||||
- name: read-yaml-file
|
|
||||||
uses: pietrobolcato/action-read-yaml@main
|
|
||||||
id: read_action_js
|
|
||||||
with:
|
|
||||||
config: ${{ github.workspace }}/config_example_env.yaml
|
|
||||||
env-var-prefix: myEnv
|
|
||||||
|
|
||||||
- name: use-yaml-file
|
|
||||||
run: |
|
|
||||||
echo environment name: $myEnv_environment_name
|
|
||||||
echo first permission name: $myEnv_environment_permissions_0_name
|
|
||||||
echo first permission permissions: $myEnv_environment_permissions_0_permission
|
|
||||||
echo second permission name: $myEnv_environment_permissions_1_name
|
|
||||||
echo second permission permissions: $myEnv_environment_permissions_1_permission
|
|
||||||
echo deployment source libs: $myEnv_deployment_code_source_libs
|
|
||||||
echo deployment source entry: $myEnv_deployment_code_source_entry
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue