Files
Gitea_Action_Test/.gitea/workflows/008_secrets_and_variables.yaml
Workflow config file is invalid. Please check your config file: yaml: line 18: could not find expected ':'

39 lines
1.5 KiB
YAML
Raw Blame History

This file contains invisible Unicode characters
This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
name: Secrets And Variables
on:
workflow_dispatch:
jobs:
build-and-deploy:
runs-on: ubuntu-22.04
env:
DEPLOYMENT_ENV: 'production' # Define a workflow-level environment variable
steps:
- name: Build
run: | # Build your application here
echo "Building the application"
echo "API KEY: ${{ secrets.API_KEY }}"
        echo $SECRET_API_KEY
echo "DEPLOYMENT_ENV: ${{ env.DEPLOYMENT_ENV }}"
echo $CONFIG_VARIABLE
        echo "USERNAME: ${{ vars.USERNAME }}"
echo $STEPS_USERNAME
env:
SECRET_API_KEY: ${{ secrets.API_KEY }} # Access a secret as an environment variable
STEPS_USERNAME: ${{ vars.USERNAME }}
CONFIG_VARIABLE: ${{ env.DEPLOYMENT_ENV }} # Use a workflow-level environment variable
- name: Deploy
run: | # Deploy your application using the secrets and variables
echo "Global job variable ${{ env.DEPLOYMENT_ENV }}"
echo "Variable from previous step ${CONFIG_VARIABLE} environment"
echo "Variable from this step ${CONFIG_VARIABLE2} environment"
echo "Local step variable ${ANOTHER_VARIABLE}"
echo "Secret print ${{ secrets.API_KEY }}"
echo "Step's secret variable ${SECRET_API_KEY}"
env:
SECRET_API_KEY: ${{ secrets.API_KEY }}
CONFIG_VARIABLE2: ${{ env.DEPLOYMENT_ENV }} # Use a workflow-level environment variable
ANOTHER_VARIABLE: 'Some value' # Define a variable directly in the workflow