Skip to content

Commit

Permalink
refactor: Redo as 'composite' Action
Browse files Browse the repository at this point in the history
  • Loading branch information
amis92 committed Aug 20, 2020
1 parent e662bfa commit 630b145
Show file tree
Hide file tree
Showing 9 changed files with 16 additions and 455 deletions.
17 changes: 8 additions & 9 deletions action.ps1
Original file line number Diff line number Diff line change
@@ -1,20 +1,19 @@
#!/usr/bin/env pwsh

$ErrorActionPreference = 'Stop'

Import-Module $PSScriptRoot/lib/GitHubActionsCore

# read inputs, set output
$stagingPath = Get-ActionInput staging-path -Required
$null = New-Item $stagingPath -ItemType Directory -ErrorAction:Ignore
Set-ActionOutput staging-path $stagingPath
[CmdletBinding()]
param (
[Parameter(Mandatory)]
[string] $StagingPath
)

# check if there are any cat/gst files to process, otherwise short-circuit out
if ((Get-ChildItem -Recurse -Include *.cat, *.gst -File).Length -eq 0) {
Write-Host "No datafiles to process." -ForegroundColor Green
exit 0
}

$null = New-Item $stagingPath -ItemType Directory -ErrorAction:Ignore

function PrintAndInvoke{
param($command)
Write-Host $command -ForegroundColor Cyan
Expand All @@ -33,6 +32,6 @@ if ($null -eq (Get-Command $wham -ErrorAction SilentlyContinue)) {
# TODO sometime in future "wham build/ci"

# Publish snapshot to staging path
PrintAndInvoke "$wham publish -f snapshot -o ""$stagingPath"" --verbosity detailed"
PrintAndInvoke "$wham publish -f snapshot -o ""$StagingPath"" --verbosity detailed"

Write-Host "Done" -ForegroundColor Green
10 changes: 8 additions & 2 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,15 @@ inputs:
outputs:
staging-path:
description: Path where generated assets were saved.
value: ${{ inputs.staging-path }}
runs:
using: node12
main: dist/index.js
using: composite
steps:
- run: ${{ github.action_path }}/action.ps1 -StagingPath $env:STAGING_PATH
shell: pwsh
id: script
env:
STAGING_PATH: ${{ inputs.staging-path }}
branding:
icon: book-open
color: blue
32 changes: 0 additions & 32 deletions build-docs.ps1

This file was deleted.

6 changes: 0 additions & 6 deletions build.ps1

This file was deleted.

1 change: 0 additions & 1 deletion dist/index.js

This file was deleted.

13 changes: 0 additions & 13 deletions invoke-pwsh.js

This file was deleted.

Loading

0 comments on commit 630b145

Please sign in to comment.