choco #14
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
name: choco | |
on: | |
push: | |
tags: | |
- "*" | |
workflow_dispatch: | |
inputs: | |
tag: | |
description: The tag to run against. This trigger runs the GoReleaser and MSI builder. | |
required: true | |
jobs: | |
release: | |
name: Deploy to chocolatey | |
runs-on: windows-latest | |
permissions: | |
contents: write | |
steps: | |
- name: Normalize tag values | |
shell: bash | |
run: | | |
if [[ "${{ github.event_name }}" == "workflow_dispatch" ]] ; then | |
VER=${{ github.event.inputs.tag }} | |
else | |
VER=${GITHUB_REF/refs\/tags\//} | |
fi | |
VERSION=${VER//v} | |
echo "VER_TAG=$VER" >> $GITHUB_ENV | |
echo "VERSION=$VERSION" >> $GITHUB_ENV | |
- name: Check out code | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Setup PowerShell module cache | |
id: cacher | |
uses: actions/cache@v3 | |
with: | |
path: "C:\\Users\\runneradmin\\Documents\\PowerShell\\Modules" | |
key: ${{ runner.os }}-InvokeBuild | |
- name: Install required PowerShell modules | |
if: steps.cacher.outputs.cache-hit != 'true' | |
shell: pwsh | |
run: | | |
Set-PSRepository PSGallery -InstallationPolicy Trusted | |
Install-Module InvokeBuild -ErrorAction Stop | |
- name: Invoke build script | |
env: | |
appName: saml2aws | |
shell: pwsh | |
run: Invoke-Build | |
- name: Test | |
run: go test -v . | |
- name: Deploy | |
run: | | |
echo ${{ env.VERSION }} | |
choco apiKey --key ${{ secrets.CHOCOLATEY_API_KEY }} --source "https://push.chocolatey.org/" | |
choco push ./choco/saml2aws.${{ env.VERSION }}.nupkg --source "https://push.chocolatey.org/" |