From 6d9dabd46b4a9d0437e4f86c47fb0f2d92116219 Mon Sep 17 00:00:00 2001 From: Tom Pughe <147526382+TomPughe@users.noreply.github.com> Date: Tue, 18 Jun 2024 09:25:54 +0100 Subject: [PATCH] Update and rename first.yml to environment-variables.yml adding exercise files --- .github/workflows/environment-variables.yml | 41 +++++++++++++++++++++ .github/workflows/first.yml | 21 ----------- 2 files changed, 41 insertions(+), 21 deletions(-) create mode 100755 .github/workflows/environment-variables.yml delete mode 100755 .github/workflows/first.yml diff --git a/.github/workflows/environment-variables.yml b/.github/workflows/environment-variables.yml new file mode 100755 index 0000000..ada4fd9 --- /dev/null +++ b/.github/workflows/environment-variables.yml @@ -0,0 +1,41 @@ +name: Environment Variables +env: + WORKSPACE_ENVIRONMENT_VARIABLE: 'custom workspace environment variable' +on: [push] +jobs: + ubuntu: + env: + JOB_ENVIRONMENT_VARIABLE: 'custom job environment variable for ubuntu' + runs-on: ubuntu-latest + steps: + - name: Print custom environment variables from ubuntu-latest + env: + STEP_ENVIRONMENT_VARIABLE: 'custom step environment variable for bash' + run: | + echo "Accessing environment variables in run command" + echo "$WORKSPACE_ENVIRONMENT_VARIABLE" + echo "$JOB_ENVIRONMENT_VARIABLE" + echo "$STEP_ENVIRONMENT_VARIABLE" + echo "------------------------------------------------------" + echo "Accessing environment variables using env context" + echo "${{ env.WORKSPACE_ENVIRONMENT_VARIABLE }}" + echo "${{ env.JOB_ENVIRONMENT_VARIABLE }}" + echo "${{ env.STEP_ENVIRONMENT_VARIABLE }} Not defined" + windows: + env: + JOB_ENVIRONMENT_VARIABLE: 'custom job environment variable for windows' + runs-on: windows-latest + steps: + - name: Print custom environment variables from windows-latest + env: + STEP_ENVIRONMENT_VARIABLE: 'custom step environment variable for powershell' + run: | + echo "Accessing environment variables in run command" + echo "$Env:WORKSPACE_ENVIRONMENT_VARIABLE" + echo "$Env:JOB_ENVIRONMENT_VARIABLE" + echo "$Env:STEP_ENVIRONMENT_VARIABLE" + echo "------------------------------------------------------" + echo "Accessing environment variables using env context" + echo "${{ env.WORKSPACE_ENVIRONMENT_VARIABLE }}" + echo "${{ env.JOB_ENVIRONMENT_VARIABLE }}" + echo "${{ env.STEP_ENVIRONMENT_VARIABLE }} Not defined" diff --git a/.github/workflows/first.yml b/.github/workflows/first.yml deleted file mode 100755 index 27569f5..0000000 --- a/.github/workflows/first.yml +++ /dev/null @@ -1,21 +0,0 @@ -name: first - -on: push - -jobs: - job1: - name: First job - runs-on: ubuntu-latest - steps: - - name: Step one - uses: actions/checkout@v2 - - name: Step two - run: env | sort - job2: - name: Second job - runs-on: windows-latest - steps: - - name: Step one - uses: actions/checkout@v2 - - name: Step two - run: "Get-ChildItem Env: | Sort-Object Name" \ No newline at end of file