diff --git a/.gitea/workflows/pipeline-test.yaml b/.gitea/workflows/pipeline-test.yaml index 830a9b6..8e3abf3 100644 --- a/.gitea/workflows/pipeline-test.yaml +++ b/.gitea/workflows/pipeline-test.yaml @@ -10,28 +10,14 @@ jobs: runs-on: ubuntu-latest steps: - 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 - ENV=$(cat deploy_env.json | jq -r '.env') - if [ -z "$ENV" ]; then - echo "Environment variable is empty." - exit 1 - fi - - # 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: 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: Set up Go uses: actions/setup-go@v5.0.0 with: @@ -74,7 +60,7 @@ jobs: run: hugo --minify - name: Deploy to Server - if: ${{ github.job.outputs.environment == 'development' }} + if: $myEnv_environment_name == 'development' uses: SamKirkland/FTP-Deploy-Action@4.0.0 with: protocol: ftps diff --git a/.gitea/workflows/read_yaml_test.yaml b/.gitea/workflows/read_yaml_test.yaml deleted file mode 100644 index 6bbb4f1..0000000 --- a/.gitea/workflows/read_yaml_test.yaml +++ /dev/null @@ -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