-
Notifications
You must be signed in to change notification settings - Fork 22
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
First Try, I swear. No rebases here.
- Loading branch information
1 parent
4533c05
commit 16c77f1
Showing
13 changed files
with
186 additions
and
33 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
#This is the bare minimum a GitHub Actions workflow can be. It runs a script that outputs a message to the console. | ||
on: workflow_dispatch | ||
|
||
#This isn't technically required, and can also be set at the job level, but it defaults to bash so why not PowerShell? | ||
defaults: | ||
run: | ||
shell: pwsh | ||
|
||
jobs: | ||
theBasics: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- run: | #In YAML this lets you write the script across multiple lines, perfect for PowerShell | ||
$date = Get-Date | ||
Write-Output "Congrats it worked at ${date}! 🎉🎉🎉" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
name: Example 02 - More Meta #Display name that will show in UI | ||
on: workflow_dispatch | ||
run-name: Run ${{ github.run_id }} by @${{ github.actor }} | ||
|
||
defaults: | ||
run: | ||
shell: pwsh | ||
|
||
jobs: | ||
theBasics: | ||
#A display name other than the job | ||
name: Demonstrate GHA Basics | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: 🕰️ Get the Date | ||
id: getDate | ||
run: | | ||
$date = Get-Date | ||
Write-Output "Congrats it worked at ${date}! 🎉🎉🎉" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
name: Example 03 - Script File | ||
on: workflow_dispatch | ||
|
||
defaults: | ||
run: | ||
shell: pwsh | ||
|
||
jobs: | ||
getExternalScript: | ||
runs-on: ubuntu-latest | ||
steps: | ||
#Checkout is needed to get the script from the repo | ||
- name: 📤 Checkout | ||
uses: actions/checkout@v2 | ||
with: | ||
fetch-depth: 0 | ||
|
||
- name: 📝 Run Script | ||
run: . ./scripts/01_basic.ps1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
name: Example 04 - Runner Info | ||
on: workflow_dispatch | ||
|
||
defaults: | ||
run: | ||
shell: pwsh | ||
|
||
jobs: | ||
getRunnerInfo: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- run: | | ||
"=== RUNNER INFO ===" | ||
$PSVersionTable | ||
"" | ||
"=== ENV VARS ===" | ||
dir env: | ||
"" | ||
"=== CURRENT DIRECTORY ===" | ||
$PWD | ||
"" | ||
"=== VARIABLES ===" | ||
Get-Variable | ft -auto name,value | ||
"" | ||
"=== LOADED MODULES ===" | ||
get-module | ft -auto name,version | ||
"" | ||
"=== AVAILABLE MODULES ===" | ||
get-module -listavailable | ft -auto name,version | ||
"" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
name: Example 05 - Multi-Step Inputs and Outputs | ||
on: | ||
workflow_dispatch: | ||
inputs: | ||
color: | ||
description: Color to set | ||
required: false | ||
default: green | ||
|
||
defaults: | ||
run: | ||
shell: pwsh | ||
|
||
jobs: | ||
multiStepInputOutput: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Set color to ${{ github.event.inputs.color }} | ||
id: color-selector | ||
run: | | ||
"SELECTED_COLOR=${{ github.event.inputs.color }}" | Out-File -FilePath $env:GITHUB_OUTPUT -Append | ||
- name: Get color | ||
env: | ||
SELECTED_COLOR: ${{ steps.color-selector.outputs.SELECTED_COLOR }} | ||
run: Write-Output "The selected color is $env:SELECTED_COLOR" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
name: Example 06 - Inputs as Script Parameters | ||
on: | ||
workflow_dispatch: | ||
inputs: | ||
color: | ||
description: Color to set | ||
required: false | ||
default: green | ||
|
||
defaults: | ||
run: | ||
shell: pwsh | ||
|
||
jobs: | ||
inputOutputScript: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Set color to ${{ github.event.inputs.color }} | ||
id: color-selector | ||
run: | | ||
$result = . scripts/06_color.ps1 -Color '${{ github.event.inputs.color }}' | ||
Write-Host -ForegroundColor $result "The selected color is $result" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
$date = Get-Date | ||
Write-Output "Congrats it worked at ${date}! 🎉🎉🎉" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
[CmdletBinding()] | ||
param( | ||
[Parameter(Mandatory)][string]$Color | ||
) | ||
|
||
"The Color is $Color" |