Skip to content

Commit 6eb7961

Browse files
authored
Merge pull request #1328 from tinaboyce/master
chore(ci): move chocolatey deployment to gha [#985]
2 parents 7852300 + b9283b0 commit 6eb7961

File tree

3 files changed

+60
-59
lines changed

3 files changed

+60
-59
lines changed

.appveyor/appveyor.yml

-57
This file was deleted.

.github/workflows/release.yml

+58
Original file line numberDiff line numberDiff line change
@@ -118,3 +118,61 @@ jobs:
118118
with:
119119
tag_name: ${{ env.VER_TAG }}
120120
files: ${{ env.INSTALLER }}/out/*.msi
121+
122+
chocolatey:
123+
name: Deploy to chocolatey
124+
runs-on: windows-latest
125+
permissions:
126+
contents: write
127+
needs: [release]
128+
if: >- # https://github.com/actions/runner/issues/491
129+
always() &&
130+
(needs.release.result == 'success' || needs.release.result == 'skipped')
131+
steps:
132+
- name: Normalize tag values
133+
shell: bash
134+
run: |
135+
if [[ "${{ github.event_name }}" == "workflow_dispatch" ]] ; then
136+
VER=${{ github.event.inputs.tag }}
137+
else
138+
VER=${GITHUB_REF/refs\/tags\//}
139+
fi
140+
141+
VERSION=${VER//v}
142+
143+
echo "VER_TAG=$VER" >> $GITHUB_ENV
144+
echo "VERSION=$VERSION" >> $GITHUB_ENV
145+
146+
- name: Check out code
147+
uses: actions/checkout@v4
148+
with:
149+
fetch-depth: 0
150+
151+
- name: Setup PowerShell module cache
152+
id: cacher
153+
uses: actions/cache@v3
154+
with:
155+
path: "C:\\Users\\runneradmin\\Documents\\PowerShell\\Modules"
156+
key: ${{ runner.os }}-InvokeBuild
157+
158+
- name: Install required PowerShell modules
159+
if: steps.cacher.outputs.cache-hit != 'true'
160+
shell: pwsh
161+
run: |
162+
Set-PSRepository PSGallery -InstallationPolicy Trusted
163+
Install-Module InvokeBuild -ErrorAction Stop
164+
165+
- name: Invoke build script
166+
env:
167+
appName: saml2aws
168+
shell: pwsh
169+
run: Invoke-Build
170+
171+
- name: Deploy
172+
shell: pwsh
173+
env:
174+
CHOCOLATEY_API_KEY: ${{ secrets.CHOCOLATEY_API_KEY }}
175+
VERSION: ${{ env.VERSION }}
176+
run: |
177+
choco apikey --key "$env:CHOCOLATEY_API_KEY" --source "https://push.chocolatey.org/"
178+
choco push ./choco/saml2aws.${env:VERSION}.nupkg --source "https://push.chocolatey.org/"

default.build.ps1

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
Set-StrictMode -Version 'Latest'
22

33
#$nameOfApp = 'saml2aws'
4-
$version = ${env:APPVEYOR_REPO_TAG_NAME}.Split('v')[1]
4+
$version = ${env:VER_TAG}.Split('v')[1]
55

66
task 'Compile Go libraries...' {
77
$ErrorActionPreference = 'Continue'
@@ -23,7 +23,7 @@ task 'Pack Choco...' {
2323
}
2424

2525
task 'Zip for GH release...' {
26-
7z a "${env:appName}.zip" "$env:APPVEYOR_BUILD_FOLDER\bin\${env:appName}.exe"
26+
7z a "${env:appName}.zip" ".\bin\${env:appName}.exe"
2727
$hash = Get-FileHash "${env:appName}.zip"
2828
"$($hash.Hash) $(Split-Path $hash.Path -Leaf)" > "${env:appName}.zip.sha256"
2929
}

0 commit comments

Comments
 (0)