@@ -118,3 +118,61 @@ jobs:
118
118
with :
119
119
tag_name : ${{ env.VER_TAG }}
120
120
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/"
0 commit comments