Skip to content

Renmae test power shell action. #2

Renmae test power shell action.

Renmae test power shell action. #2

name: test-install-powershell-package
on:
push:
branches: [code-signing]
jobs:
setup:
if: github.repository == 'hsorby/mapclient'
runs-on: ubuntu-latest
outputs:
matrix: ${{ steps.set-matrix.outputs.matrix }}
run-installer: ${{ steps.set-matrix.outputs.run-installer }}
package: ${{ steps.set-matrix.outputs.run-packaging }}
tag: ${{ steps.get-tag.outputs.tag }}
steps:
- name: Get the tag
id: get-tag
shell: bash
run: |
echo "Setting tag as: vX.Y.Z"
echo "tag=vX.Y.Z" >> $GITHUB_OUTPUT
- name: Get the release name
id: get-release-name
shell: bash
run: |
tag=${{ steps.get-tag.outputs.tag }}
bare_tag=${tag/v/}
IFS='.' read -ra bare_tag_parts <<< "$bare_tag"
name="${bare_tag_parts[0]}.${bare_tag_parts[1]}.${bare_tag_parts[2]}"
echo "Setting name as: ${name}"
echo "name=$name" >> $GITHUB_OUTPUT
- name: Determine required assets
id: set-variants
shell: cmake -P {0}
run: |
set(RELEASE_BODY "${{ github.event.release.body }}")
string(REPLACE "\n" ";" _PARTS "${RELEASE_BODY}")
set(VARIANTS standard)
message(STATUS "variants=\"${VARIANTS}\"")
file(APPEND $ENV{GITHUB_OUTPUT} "variants=\"${VARIANTS}\"")
- name: set_matrix
id: set-matrix
shell: bash
run: |
matrixElements=()
variants=${{ steps.set-variants.outputs.variants }}
for v in $variants; do
matrixElements+=('{"os":"windows-2022","variant":"'$v'","tag":"${{ steps.get-tag.outputs.tag }}","release-name":"${{ steps.get-release-name.outputs.name }}","python-version":"3.9"}')
done
if [ "${#matrixElements[@]}" -eq "0" ]; then
echo run-installer=false >> $GITHUB_OUTPUT
echo run-packaging=false >> $GITHUB_OUTPUT
else
echo run-installer=true >> $GITHUB_OUTPUT
echo run-packaging=true >> $GITHUB_OUTPUT
fi
function join_by { local IFS="$1"; shift; echo "$*"; }
content=`join_by , ${matrixElements[@]}`
echo "{\"include\":[$content]}"
echo "matrix={\"include\":[$content]}" >> $GITHUB_OUTPUT
installer:
needs: setup
name: installer
if: needs.setup.outputs.run-installer == 'true'
runs-on: ${{ matrix.os }}
strategy:
matrix: ${{fromJson(needs.setup.outputs.matrix)}}
steps:
- name: Install PowerShell module SignPath (Windows)
if: runner.os == 'Windows'
shell: pwsh
run: |
Install-Module -Name SignPath