Skip to content

Commit 818967f

Browse files
authored
output, readme, more (#1)
1 parent ff13645 commit 818967f

5 files changed

Lines changed: 29 additions & 10 deletions

File tree

.github/workflows/test.yml

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,21 @@ name: test
22

33
on:
44
workflow_dispatch:
5+
push:
56

67
jobs:
78
test-action:
89
runs-on: ubuntu-latest
910
steps:
1011
- uses: gdbarron/VenafiPS-action@main
12+
id: get-certs
1113
with:
1214
token: ${{ secrets.VENAFI_TOKEN }}
13-
server: gdb-tpp.se.venafi.com
15+
tpp_server: ${{ secrets.VENAFI_SERVER }}
1416
commands: |
1517
find-venaficertificate -first 5
18+
$action_out = find-venaficertificate -first 5 | ConvertTo-Json -Depth 5 -Compress
19+
- name: test output
20+
shell: pwsh
21+
run: |
22+
'${{ steps.get-certs.outputs.action_out}}' | ConvertFrom-Json

Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,6 @@ FROM mcr.microsoft.com/powershell:latest
22

33
SHELL ["pwsh"]
44

5-
COPY /*.ps1 /
5+
COPY /entrypoint.ps1 /
66

77
ENTRYPOINT ["pwsh", "/entrypoint.ps1"]

README.md

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# VenafiPS GitHub action
22

3-
Automate Venafi with GitHub actions.
3+
Automate Venafi with GitHub actions. Utilizes the [VenafiPS Powershell module](https://github.com/venafi/venafips).
44

55
``` yaml
66
name: test
@@ -12,10 +12,12 @@ jobs:
1212
test-action:
1313
runs-on: ubuntu-latest
1414
steps:
15-
- uses: gdbarron/VenafiPS-action@main
15+
- name: renew certs
16+
uses: gdbarron/venafips-action@main
1617
with:
1718
token: ${{ secrets.VENAFI_TOKEN }}
18-
server: server.company.com
19+
server: ${{ secrets.VENAFI_SERVER }}
1920
commands: |
2021
Find-VenafiCertificate -First 5 | Invoke-VenafiCertificateAction -Renew
22+
$action_out = '' # set this variable to use in another step
2123
```

action.yml

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,22 @@
11
name: 'VenafiPS'
2-
description: 'Execute commands from VenafiPS Powershell module'
2+
description: 'Execute commands from VenafiPS Powershell module, https://github.com/Venafi/VenafiPS'
33
author: 'Greg Brownstein'
44
inputs:
55
token:
66
description: TPP token or VaaS key
77
required: true
8-
server:
8+
tpp_server:
99
description: TPP server name. Not required for VaaS.
1010
required: false
1111
commands:
1212
description: Module commands to execute
1313
required: true
14+
output:
15+
action_out:
16+
description: 'Output from action to be used further in the pipeline'
1417
runs:
1518
using: 'docker'
1619
image: 'Dockerfile'
20+
branding:
21+
icon: terminal
22+
color: orange

entrypoint.ps1

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
$server = $env:INPUT_SERVER
1+
$server = $env:INPUT_TPP_SERVER
22
$token = $env:INPUT_TOKEN
33

44
Set-PSRepository PSGallery -InstallationPolicy Trusted
@@ -18,13 +18,17 @@ if ( [System.Guid]::TryParse($token, [System.Management.Automation.PSReference]$
1818
else {
1919

2020
Write-Output 'Token is TPP token'
21-
21+
2222
if ( -not $server ) {
2323
throw "'server' parameter is required when connecting to TPP"
2424
}
25-
25+
2626
New-VenafiSession -Server $server -AccessToken (New-Object System.Management.Automation.PSCredential('AccessToken', ($token | ConvertTo-SecureString -AsPlainText -Force)))
2727
}
2828

2929

3030
Invoke-Expression $env:INPUT_COMMANDS
31+
32+
if ( $action_out ) {
33+
Write-Output "::set-output name=action_out::$action_out"
34+
}

0 commit comments

Comments
 (0)