choco #11
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 chocolately | |
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: Set up Go 1.x | |
uses: actions/setup-go@v5 | |
with: | |
go-version-file: "go.mod" | |
- name: Setup PowerShell module cache | |
id: cacher | |
uses: actions/cache@v3 | |
with: | |
path: "~/.local/share/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: Build | |
run: | | |
echo ${env.VERSION} | |
echo "${env.VERSION}" | |
go build -o "bin/saml2aws.exe" -ldflags "-X main.Version=${env.VERSION}" "./cmd/saml2aws" | |
- name: Invoke build script | |
env: | |
appName: saml2aws | |
shell: pwsh | |
run: Invoke-Build | |
- name: Test | |
run: go test -v . | |
- name: Deploy | |
env: | |
CHOCOLATEY_API_KEY: ${{ secrets.CHOCOLATEY_API_KEY }} | |
VERSION: ${{ env.VERSION }} | |
run: | | |
echo $VERSION | |
echo "$VERSION" | |
echo ${VERSION} | |
choco apiKey --key $CHOCOLATEY_API_KEY --source "https://push.chocolatey.org/" | |
choco push ./choco/saml2aws.$VERSION.nupkg --source "https://push.chocolatey.org/" |