Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Microsoft Installer (MSI) package to releases #766

Merged
merged 29 commits into from
Mar 21, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
146fea1
add support for building Windows MSI
briantist Feb 3, 2022
7cfcc68
fix paths
briantist Feb 3, 2022
3798118
fix env file
briantist Feb 3, 2022
4a4bdad
fix download action parameter
briantist Feb 3, 2022
3c44353
fix repository parameter
briantist Feb 3, 2022
01c61f6
fix tag references
briantist Feb 3, 2022
ee6f185
typo
briantist Feb 3, 2022
45be97b
fix tag again
briantist Feb 3, 2022
d616ccf
use full paths
briantist Feb 3, 2022
e9c3641
workflow dispatch
briantist Feb 3, 2022
9bf90ce
better description
briantist Feb 3, 2022
ad42b30
needs conditional
briantist Feb 3, 2022
106519e
tag fixups
briantist Feb 3, 2022
430d80f
bash me
briantist Feb 3, 2022
2ce9149
Update .github/workflows/release.yml
briantist May 3, 2022
62ed30a
Merge branch 'master' into windows/msi-packages
briantist Oct 26, 2022
7d4c187
Merge branch 'master' into windows/msi-packages
briantist Nov 18, 2022
29d075b
Merge branch 'master' into windows/msi-packages
briantist Dec 12, 2022
14100fa
Merge branch 'master' into windows/msi-packages
briantist Mar 3, 2023
daa1a44
Merge remote-tracking branch 'upstream/master' into windows/msi-packages
briantist Mar 6, 2023
b1ea919
bump action versions
briantist Mar 6, 2023
4e3c918
Merge branch 'master' into windows/msi-packages
briantist Mar 7, 2023
5ba82f8
Merge branch 'master' into windows/msi-packages
mapkon Mar 8, 2023
40f0146
Merge branch 'master' into windows/msi-packages
briantist Mar 14, 2023
5d77eec
Merge branch 'master' into windows/msi-packages
briantist Mar 15, 2023
67993f4
Merge branch 'master' into windows/msi-packages
mapkon Mar 17, 2023
1007e1c
Merge branch 'master' into windows/msi-packages
briantist Mar 18, 2023
aebff57
Merge branch 'master' into windows/msi-packages
mapkon Mar 20, 2023
e2ea64d
Merge branch 'master' into windows/msi-packages
mapkon Mar 21, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .github/win-msi/out/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
**
!.gitignore
28 changes: 28 additions & 0 deletions .github/win-msi/src/saml2aws.wxs
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
<?xml version="1.0" encoding="UTF-8"?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
<Product Id="*" UpgradeCode="042c301c-5154-4a77-9438-a01d4d2a9dd4" Version="$(var.Saml2AwsVer)" Language="1033" Name="saml2aws" Manufacturer="Versent">
<Package InstallerVersion="300" Compressed="yes" Description="!(bind.property.ProductName) !(bind.property.ProductVersion)" Platform="x64"/>
<Media Id="1" Cabinet="saml2aws.cab" EmbedCab="yes" />

<!-- Step 1: Define the directory structure -->
<Directory Id="TARGETDIR" Name="SourceDir">
<Directory Id="ProgramFiles64Folder">
<Directory Id="APPLICATIONROOTDIRECTORY" Name="Versent"/>
</Directory>
</Directory>

<!-- Step 2: Add files to your installer package -->
<DirectoryRef Id="APPLICATIONROOTDIRECTORY">
<Component Id="saml2aws.exe" Guid="4909b826-b4d1-4f46-9b55-ab765a04dc24" Win64="yes">
<File Id="saml2awscli" Name="saml2aws.exe" Source="src\bin\saml2aws.exe" KeyPath="yes" Checksum="yes"/>
<!-- Set the PATH to include the binary -->
<Environment Id="PATH" Name="PATH" Value="[APPLICATIONROOTDIRECTORY]" Permanent="no" Part="last" Action="set" System="yes" />
</Component>
</DirectoryRef>

<!-- Step 3: Tell WiX to install the files -->
<Feature Id="MainApplication" Title="saml2aws CLI" Level="1">
<ComponentRef Id="saml2aws.exe" />
</Feature>
</Product>
</Wix>
3 changes: 3 additions & 0 deletions .github/win-msi/wix.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#!/usr/bin/env sh
candle src/saml2aws.wxs -dSaml2AwsVer=${VERSION} -o "out/"
light -sval "out/saml2aws.wixobj" -o "out/saml2aws_${VERSION}_windows_amd64.msi"
63 changes: 62 additions & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,12 @@ name: release
on:
push:
tags:
- '*'
- '*'
workflow_dispatch:
inputs:
tag:
description: The tag to run against. This trigger only runs the MSI builder.
required: true

jobs:
release:
Expand All @@ -17,6 +22,7 @@ jobs:
- ubuntu-latest
- macos-latest
runs-on: ${{ matrix.os }}
if: github.event_name != 'workflow_dispatch'
steps:

- name: Set up Go 1.x
Expand All @@ -38,3 +44,58 @@ jobs:
args: release --clean --config .goreleaser.${{ matrix.os }}.yml
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

windows-msi:
name: Build Windows MSI and upload to release
runs-on: ubuntu-latest
needs: [release]
if: >- # https://github.com/actions/runner/issues/491
always() &&
(needs.release.result == 'success' || needs.release.result == 'skipped')
env:
INSTALLER: ${{ github.workspace }}/.github/win-msi
BIN: ${{ github.workspace }}/.github/win-msi/src/bin
WIXIMG: dactiv/wix@sha256:17d232708589641f5632f9a1ff9463ad087b192cea7b8e6012d2b47ec6af5f6c
steps:
- name: Normalize tag values
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
echo "ASSET=saml2aws_${VERSION}_windows_amd64.zip" >> $GITHUB_ENV

- name: Check out code
uses: actions/checkout@v3

- name: Retrieve the release asset
id: asset
uses: robinraju/release-downloader@768b85c8d69164800db5fc00337ab917daf3ce68 # v1.7
with:
repository: ${{ github.repository }}
tag: ${{ env.VER_TAG }}
fileName: ${{ env.ASSET }}
out-file-path: ${{ env.BIN }}

- name: Unzip asset
working-directory: ${{ env.BIN }}
run: unzip "${ASSET}"

- name: Build MSI
run: |
# container does not run as root
chmod -R o+rw "${INSTALLER}"

cat "${INSTALLER}/wix.sh" | docker run --rm -i -e VERSION -v "${INSTALLER}:/wix" ${WIXIMG} /bin/sh

- name: Upload the asset to the release
uses: softprops/action-gh-release@de2c0eb89ae2a093876385947365aca7b0e5f844 # v0.1.15 / v1
with:
tag_name: ${{ env.VER_TAG }}
files: ${{ env.INSTALLER }}/out/*.msi