Skip to content

Commit

Permalink
Merge pull request Versent#1328 from tinaboyce/master
Browse files Browse the repository at this point in the history
chore(ci): move chocolatey deployment to gha [Versent#985]
  • Loading branch information
mapkon authored Aug 3, 2024
2 parents 7852300 + b9283b0 commit 6eb7961
Show file tree
Hide file tree
Showing 3 changed files with 60 additions and 59 deletions.
57 changes: 0 additions & 57 deletions .appveyor/appveyor.yml

This file was deleted.

58 changes: 58 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -118,3 +118,61 @@ jobs:
with:
tag_name: ${{ env.VER_TAG }}
files: ${{ env.INSTALLER }}/out/*.msi

chocolatey:
name: Deploy to chocolatey
runs-on: windows-latest
permissions:
contents: write
needs: [release]
if: >- # https://github.com/actions/runner/issues/491
always() &&
(needs.release.result == 'success' || needs.release.result == 'skipped')
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: Deploy
shell: pwsh
env:
CHOCOLATEY_API_KEY: ${{ secrets.CHOCOLATEY_API_KEY }}
VERSION: ${{ env.VERSION }}
run: |
choco apikey --key "$env:CHOCOLATEY_API_KEY" --source "https://push.chocolatey.org/"
choco push ./choco/saml2aws.${env:VERSION}.nupkg --source "https://push.chocolatey.org/"
4 changes: 2 additions & 2 deletions default.build.ps1
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Set-StrictMode -Version 'Latest'

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

task 'Compile Go libraries...' {
$ErrorActionPreference = 'Continue'
Expand All @@ -23,7 +23,7 @@ task 'Pack Choco...' {
}

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

0 comments on commit 6eb7961

Please sign in to comment.