Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ShowDemo 0.1.7 - ShowDemo in Docker #108

Merged
merged 19 commits into from
Apr 14, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 30 additions & 1 deletion .github/workflows/BuildShowDemo.yml
Original file line number Diff line number Diff line change
Expand Up @@ -607,9 +607,38 @@ jobs:
- name: PSA
uses: StartAutomating/PSA@main
id: PSA
- name: Log in to the Container registry
uses: docker/login-action@master
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@master
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
- name: Build and push Docker image (from main)
if: ${{github.ref_name == 'main' || github.ref_name == 'master' || github.ref_name == 'latest'}}
uses: docker/build-push-action@master
with:
context: .
push: true
tags: latest
labels: ${{ steps.meta.outputs.labels }}
- name: Build and push Docker image (from branch)
if: ${{github.ref_name != 'main' && github.ref_name != 'master' && github.ref_name != 'latest'}}
uses: docker/build-push-action@master
with:
context: .
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
on:
push:
pull_request:
env:
AT_PROTOCOL_APP_PASSWORD: ${{ secrets.AT_PROTOCOL_APP_PASSWORD }}
AT_PROTOCOL_HANDLE: mrpowershell.bsky.social
AT_PROTOCOL_APP_PASSWORD: ${{ secrets.AT_PROTOCOL_APP_PASSWORD }}
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}
39 changes: 39 additions & 0 deletions Build/GitHub/Jobs/BuildShowDemo.psd1
Original file line number Diff line number Diff line change
Expand Up @@ -50,5 +50,44 @@
uses = 'StartAutomating/PSA@main'
id = 'PSA'
}
@{
'name'='Log in to the Container registry'
'uses'='docker/login-action@master'
'with'=@{
'registry'='${{ env.REGISTRY }}'
'username'='${{ github.actor }}'
'password'='${{ secrets.GITHUB_TOKEN }}'
}
},
@{
'name'='Extract metadata (tags, labels) for Docker'
'id'='meta'
'uses'='docker/metadata-action@master'
'with'=@{
'images'='${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}'
}
},
@{
name = 'Build and push Docker image (from main)'
if = '${{github.ref_name == ''main'' || github.ref_name == ''master'' || github.ref_name == ''latest''}}'
uses = 'docker/build-push-action@master'
'with'=@{
'context'='.'
'push'='true'
'tags'='latest'
'labels'='${{ steps.meta.outputs.labels }}'
}
},
@{
name = 'Build and push Docker image (from branch)'
if = '${{github.ref_name != ''main'' && github.ref_name != ''master'' && github.ref_name != ''latest''}}'
uses = 'docker/build-push-action@master'
with = @{
'context'='.'
'push'='true'
'tags'='${{ steps.meta.outputs.tags }}'
'labels'='${{ steps.meta.outputs.labels }}'
}
}
)
}
6 changes: 4 additions & 2 deletions Build/ShowDemo.GitHubWorkflow.PSDevOps.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,12 @@ Push-Location ($PSScriptRoot | Split-Path)

New-GitHubWorkflow -Job PowerShellStaticAnalysis, TestPowerShellOnLinux, TagReleaseAndPublish, BuildShowDemo -OutputPath @'
.\.github\workflows\BuildShowDemo.yml
'@ -Name "Build, Test, and Release ShowDemo" -On Push, PullRequest -Env @{
'@ -Name "Build, Test, and Release ShowDemo" -On Push, PullRequest -Env ([Ordered]@{
"AT_PROTOCOL_HANDLE" = "mrpowershell.bsky.social"
"AT_PROTOCOL_APP_PASSWORD" = '${{ secrets.AT_PROTOCOL_APP_PASSWORD }}'
}
"REGISTRY" = "ghcr.io"
"IMAGE_NAME" = '${{ github.repository }}'
})

Import-BuildStep -ModuleName GitPub

Expand Down
16 changes: 16 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,19 @@
> Like It? [Star It](https://github.com/StartAutomating/ShowDemo)
> Love It? [Support It](https://github.com/sponsors/StartAutomating)

---

## ShowDemo 0.1.7:

* ShowDemo in Docker (#103)
* Added Dockerfile (#104)
* Publishing all builds to GitHub Container Registry (#105)
* Added Trinity of Discoverability Demo (#51)
* Exporting $ShowDemo (#106)
* Mounting as ShowDemo: (#107)

---

## ShowDemo 0.1.6:

* Show-Demo Syncing Console Encoding ( Fixes #101 )
Expand Down
455 changes: 455 additions & 0 deletions Demos/Trinity-Of-Discoverability.demo.md

Large diffs are not rendered by default.

53 changes: 53 additions & 0 deletions Demos/Trinity-Of-Discoverability.demo.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
#1. Get-Command

# Get-Command is one of three commands that make up the Trinity of Discoverability.

# These three commands will help you find your way around what PowerShell can do.

# Get-Command helps you find out what commands exist.

Get-Command -Module ShowDemo

# Because everything is an object in PowerShell, we can pipe this into other commands.

# So, if we wanted to just get a random loaded command from Show-Demo, we'd use:

Get-Command -Module ShowDemo | Get-Random

# In PowerShell, it's common for commands to share similar names.

# So we can search for commands by wildcard:

Get-Command *Demo*

#2. Get-Help

# Get-Help helps us figure out how commands work.

Get-Help Show-Demo

# By default, you see an overview of available help.

# We can get help about each parameter by using -Parameter *

Get-Help Show-Demo -Parameter *

#3. Get-Member

# Get-Member helps us figure out what properties and methods are available on an object.

# For example, we can see what properties are available on the output of Get-Command:

Get-Command -Module ShowDemo | Get-Member

# Every object has members. Let's get the members of ShowDemo

Get-Module ShowDemo | Get-Member

# We can also get -Static members. This is especially useful for classes.

[Math] | Get-Member -Static




4 changes: 4 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
FROM mcr.microsoft.com/powershell
COPY . ./usr/local/share/powershell/Modules/ShowDemo
RUN pwsh -c "New-Item -Path /root/.config/powershell/Microsoft.PowerShell_profile.ps1 -Value 'Import-Module ShowDemo' -Force"

15 changes: 15 additions & 0 deletions ShowDemo.ps.psm1
Original file line number Diff line number Diff line change
@@ -1 +1,16 @@
[Include('*-*.ps1')]$PSScriptRoot

$thisModule = $MyInvocation.MyCommand.ScriptBlock.Module
$thisModule.pstypenames.insert(0, $thisModule.Name)
$ExecutionContext.SessionState.PSVariable.Set($thisModule.Name, $thisModule)

$newDriveSplat = [ordered]@{
Name = $thisModule.Name
PSProvider = 'FileSystem'
Root = $PSScriptRoot
ErrorAction = 'Ignore'
}

New-PSDrive @newDriveSplat

Export-ModuleMember -Variable $thisModule.Name -Function * -Alias *
21 changes: 12 additions & 9 deletions ShowDemo.psd1
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
Copyright = '2022-2024 Start-Automating'
Description = 'A simple tool to showcase your scripts.'
Guid = 'c4516317-f99e-44cf-b138-d8c4d1eadf66'
ModuleVersion = '0.1.6'
ModuleVersion = '0.1.7'
RootModule = 'ShowDemo.psm1'
FormatsToProcess = 'ShowDemo.format.ps1xml'
TypesToProcess = 'ShowDemo.types.ps1xml'
Expand All @@ -14,18 +14,21 @@
ProjectURI = 'https://github.com/StartAutomating/ShowDemo'
LicenseURI = 'https://github.com/StartAutomating/ShowDemo/blob/main/LICENSE'
ReleaseNotes = @'
## ShowDemo 0.1.6:
## ShowDemo 0.1.7:

* Show-Demo Syncing Console Encoding ( Fixes #101 )
* Show-Demo -PauseBetweenLine(s) ( Fixes #100 )
* Adjusting Default Type Speed ( Fixes #97 )
* Showing unknown steps in White, not Output ( Fixes #99 )
* ShowDemo in Docker (#103)
* Added Dockerfile (#104)
* Publishing all builds to GitHub Container Registry (#105)
* Added Trinity of Discoverability Demo (#51)
* Exporting $ShowDemo (#106)
* Mounting as ShowDemo: (#107)

---

Full history in [CHANGELOG](https://github.com/StartAutomating/ShowDemo/blob/main/CHANGELOG.md)

Previous release notes in [CHANGELOG](https://github.com/StartAutomating/ShowDemo/blob/main/CHANGELOG.md)

Like It? [Star It](https://github.com/StartAutomating/ShowDemo)! Love It? [Support It](https://github.com/sponsors/StartAutomating)!
> Like It? [Star It](https://github.com/StartAutomating/ShowDemo)
> Love It? [Support It](https://github.com/sponsors/StartAutomating)
'@
Recommendation = 'obs-powershell', 'Posh'
}
Expand Down
14 changes: 14 additions & 0 deletions ShowDemo.psm1
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,17 @@
. $file.FullName
}

$thisModule = $MyInvocation.MyCommand.ScriptBlock.Module
$thisModule.pstypenames.insert(0, $thisModule.Name)
$ExecutionContext.SessionState.PSVariable.Set($thisModule.Name, $thisModule)

$newDriveSplat = [ordered]@{
Name = $thisModule.Name
PSProvider = 'FileSystem'
Root = $PSScriptRoot
ErrorAction = 'Ignore'
}

New-PSDrive @newDriveSplat

Export-ModuleMember -Variable $thisModule.Name -Function * -Alias *
16 changes: 16 additions & 0 deletions docs/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,19 @@
> Like It? [Star It](https://github.com/StartAutomating/ShowDemo)
> Love It? [Support It](https://github.com/sponsors/StartAutomating)

---

## ShowDemo 0.1.7:

* ShowDemo in Docker (#103)
* Added Dockerfile (#104)
* Publishing all builds to GitHub Container Registry (#105)
* Added Trinity of Discoverability Demo (#51)
* Exporting $ShowDemo (#106)
* Mounting as ShowDemo: (#107)

---

## ShowDemo 0.1.6:

* Show-Demo Syncing Console Encoding ( Fixes #101 )
Expand Down
Loading