From 146fea1b38985237403540631fbc5a5bec2787a5 Mon Sep 17 00:00:00 2001 From: Brian Scholer <1260690+briantist@users.noreply.github.com> Date: Thu, 3 Feb 2022 16:40:17 -0500 Subject: [PATCH 01/16] add support for building Windows MSI --- .github/win-msi/out/.gitignore | 2 ++ .github/win-msi/src/saml2aws.wxs | 28 ++++++++++++++++++ .github/win-msi/wix.sh | 3 ++ .github/workflows/release.yml | 50 +++++++++++++++++++++++++++++++- 4 files changed, 82 insertions(+), 1 deletion(-) create mode 100644 .github/win-msi/out/.gitignore create mode 100644 .github/win-msi/src/saml2aws.wxs create mode 100644 .github/win-msi/wix.sh diff --git a/.github/win-msi/out/.gitignore b/.github/win-msi/out/.gitignore new file mode 100644 index 000000000..1287e9bd7 --- /dev/null +++ b/.github/win-msi/out/.gitignore @@ -0,0 +1,2 @@ +** +!.gitignore diff --git a/.github/win-msi/src/saml2aws.wxs b/.github/win-msi/src/saml2aws.wxs new file mode 100644 index 000000000..f1b2c8571 --- /dev/null +++ b/.github/win-msi/src/saml2aws.wxs @@ -0,0 +1,28 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/.github/win-msi/wix.sh b/.github/win-msi/wix.sh new file mode 100644 index 000000000..cbf8dc092 --- /dev/null +++ b/.github/win-msi/wix.sh @@ -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" diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index be7f776f2..eadd358e1 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -8,7 +8,7 @@ on: jobs: release: name: release - runs-on: macOS-latest + runs-on: macos-latest steps: - name: Set up Go 1.x @@ -26,3 +26,51 @@ jobs: args: release --rm-dist env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + + windows-msi: + name: Build Windows MSI and upload to release + runs-on: ubuntu-latest + needs: [release] + env: + INSTALLER: win-msi + BIN: win-msi/src/bin + WIXIMG: dactiv/wix@sha256:17d232708589641f5632f9a1ff9463ad087b192cea7b8e6012d2b47ec6af5f6c + steps: + - name: Strip v from version tag + run: | + VER=${{ github.ref }} + VERSION=${VER//v} + echo "VERSION=$VERSION" >> $GITHUB_ENV + echo "ASSET=saml2aws_${VERSION}_windows_amd64.zip" >> $GITHUB_EVENT + + - name: Set up Go 1.x + uses: actions/setup-go@v2 + with: + go-version: 1.17.x + + - name: Check out code + uses: actions/checkout@v2 + + - name: Retrieve the release asset + id: asset + uses: robinraju/release-downloader@4bdb8ee081c9ee08a35320794dd461312ac9e4ad # v1.3 + with: + tag: ${{ github.ref }} + file: ${{ 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@1e07f4398721186383de40550babbdf2b84acfc5 # v0.1.14 / v1 + with: + files: ${{ env.INSTALLER }}/out/*.msi From 7cfcc685915d9009564ab0c02ddafd991efae2eb Mon Sep 17 00:00:00 2001 From: Brian Scholer <1260690+briantist@users.noreply.github.com> Date: Thu, 3 Feb 2022 16:41:39 -0500 Subject: [PATCH 02/16] fix paths --- .github/workflows/release.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index eadd358e1..68a479d6a 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -32,8 +32,8 @@ jobs: runs-on: ubuntu-latest needs: [release] env: - INSTALLER: win-msi - BIN: win-msi/src/bin + INSTALLER: .github/win-msi + BIN: .github/win-msi/src/bin WIXIMG: dactiv/wix@sha256:17d232708589641f5632f9a1ff9463ad087b192cea7b8e6012d2b47ec6af5f6c steps: - name: Strip v from version tag From 37981185738fc69125777631f58d5840b1ae86fc Mon Sep 17 00:00:00 2001 From: Brian Scholer <1260690+briantist@users.noreply.github.com> Date: Thu, 3 Feb 2022 16:49:14 -0500 Subject: [PATCH 03/16] fix env file --- .github/workflows/release.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 68a479d6a..6a2706af2 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -41,7 +41,7 @@ jobs: VER=${{ github.ref }} VERSION=${VER//v} echo "VERSION=$VERSION" >> $GITHUB_ENV - echo "ASSET=saml2aws_${VERSION}_windows_amd64.zip" >> $GITHUB_EVENT + echo "ASSET=saml2aws_${VERSION}_windows_amd64.zip" >> $GITHUB_ENV - name: Set up Go 1.x uses: actions/setup-go@v2 From 4a4bdadfeb457f79c18fdd6223b4e34e5f57a57a Mon Sep 17 00:00:00 2001 From: Brian Scholer <1260690+briantist@users.noreply.github.com> Date: Thu, 3 Feb 2022 16:58:39 -0500 Subject: [PATCH 04/16] fix download action parameter --- .github/workflows/release.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 6a2706af2..beb3bf6b9 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -56,7 +56,7 @@ jobs: uses: robinraju/release-downloader@4bdb8ee081c9ee08a35320794dd461312ac9e4ad # v1.3 with: tag: ${{ github.ref }} - file: ${{ env.ASSET }} + fileName: ${{ env.ASSET }} out-file-path: ${{ env.BIN }} - name: Unzip asset From 3c44353c4b14b8b8e4fdf126d360c6d022e0b36c Mon Sep 17 00:00:00 2001 From: Brian Scholer <1260690+briantist@users.noreply.github.com> Date: Thu, 3 Feb 2022 17:12:54 -0500 Subject: [PATCH 05/16] fix repository parameter --- .github/workflows/release.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index beb3bf6b9..40873d116 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -55,6 +55,7 @@ jobs: id: asset uses: robinraju/release-downloader@4bdb8ee081c9ee08a35320794dd461312ac9e4ad # v1.3 with: + repository: ${{ github.repository }} tag: ${{ github.ref }} fileName: ${{ env.ASSET }} out-file-path: ${{ env.BIN }} From 01c61f6809f5cd6036bbb2a2cc77e42a596d9767 Mon Sep 17 00:00:00 2001 From: Brian Scholer <1260690+briantist@users.noreply.github.com> Date: Thu, 3 Feb 2022 17:39:37 -0500 Subject: [PATCH 06/16] fix tag references --- .github/workflows/release.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 40873d116..d3ccfc3f6 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -38,7 +38,7 @@ jobs: steps: - name: Strip v from version tag run: | - VER=${{ github.ref }} + VER=${GITHUB_REF/refs\/tags\//} VERSION=${VER//v} echo "VERSION=$VERSION" >> $GITHUB_ENV echo "ASSET=saml2aws_${VERSION}_windows_amd64.zip" >> $GITHUB_ENV @@ -56,7 +56,7 @@ jobs: uses: robinraju/release-downloader@4bdb8ee081c9ee08a35320794dd461312ac9e4ad # v1.3 with: repository: ${{ github.repository }} - tag: ${{ github.ref }} + tag: ${{ env:VER }} fileName: ${{ env.ASSET }} out-file-path: ${{ env.BIN }} From ee6f185aa3766fe35e428541b1045e5d5a2fd095 Mon Sep 17 00:00:00 2001 From: Brian Scholer <1260690+briantist@users.noreply.github.com> Date: Thu, 3 Feb 2022 17:40:22 -0500 Subject: [PATCH 07/16] typo --- .github/workflows/release.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index d3ccfc3f6..bfb42ee1b 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -56,7 +56,7 @@ jobs: uses: robinraju/release-downloader@4bdb8ee081c9ee08a35320794dd461312ac9e4ad # v1.3 with: repository: ${{ github.repository }} - tag: ${{ env:VER }} + tag: ${{ env.VER }} fileName: ${{ env.ASSET }} out-file-path: ${{ env.BIN }} From 45be97bd0fe4cdf554601baada8ec9d46f058b2a Mon Sep 17 00:00:00 2001 From: Brian Scholer <1260690+briantist@users.noreply.github.com> Date: Thu, 3 Feb 2022 17:49:29 -0500 Subject: [PATCH 08/16] fix tag again --- .github/workflows/release.yml | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index bfb42ee1b..540601871 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -7,6 +7,7 @@ on: jobs: release: + if: 'false' # testing name: release runs-on: macos-latest steps: @@ -30,7 +31,7 @@ jobs: windows-msi: name: Build Windows MSI and upload to release runs-on: ubuntu-latest - needs: [release] + # needs: [release] env: INSTALLER: .github/win-msi BIN: .github/win-msi/src/bin @@ -40,6 +41,7 @@ jobs: run: | VER=${GITHUB_REF/refs\/tags\//} VERSION=${VER//v} + echo "VER_TAG=$VER" >> $GITHUB_ENV echo "VERSION=$VERSION" >> $GITHUB_ENV echo "ASSET=saml2aws_${VERSION}_windows_amd64.zip" >> $GITHUB_ENV @@ -56,7 +58,7 @@ jobs: uses: robinraju/release-downloader@4bdb8ee081c9ee08a35320794dd461312ac9e4ad # v1.3 with: repository: ${{ github.repository }} - tag: ${{ env.VER }} + tag: ${{ env.VER_TAG }} fileName: ${{ env.ASSET }} out-file-path: ${{ env.BIN }} From d616ccf89d512f005de721a11e0a0e657e0b3c87 Mon Sep 17 00:00:00 2001 From: Brian Scholer <1260690+briantist@users.noreply.github.com> Date: Thu, 3 Feb 2022 17:54:15 -0500 Subject: [PATCH 09/16] use full paths --- .github/workflows/release.yml | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 540601871..b33487ee8 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -33,8 +33,8 @@ jobs: runs-on: ubuntu-latest # needs: [release] env: - INSTALLER: .github/win-msi - BIN: .github/win-msi/src/bin + INSTALLER: ${{ github.workspace }}/.github/win-msi + BIN: ${{ github.workspace }}/.github/win-msi/src/bin WIXIMG: dactiv/wix@sha256:17d232708589641f5632f9a1ff9463ad087b192cea7b8e6012d2b47ec6af5f6c steps: - name: Strip v from version tag @@ -45,11 +45,6 @@ jobs: echo "VERSION=$VERSION" >> $GITHUB_ENV echo "ASSET=saml2aws_${VERSION}_windows_amd64.zip" >> $GITHUB_ENV - - name: Set up Go 1.x - uses: actions/setup-go@v2 - with: - go-version: 1.17.x - - name: Check out code uses: actions/checkout@v2 From e9c36410d91aca79bbe7f839cb4a6694be93634c Mon Sep 17 00:00:00 2001 From: Brian Scholer <1260690+briantist@users.noreply.github.com> Date: Thu, 3 Feb 2022 18:14:07 -0500 Subject: [PATCH 10/16] workflow dispatch --- .github/workflows/release.yml | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index b33487ee8..8cbe77178 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -4,12 +4,17 @@ on: push: tags: - '*' + workflow_dispatch: + inputs: + tag: + description: The tag to run against. If release exists, only the MSI builder runs. + required: true jobs: release: - if: 'false' # testing name: release runs-on: macos-latest + if: github.event_name != 'workflow_dispatch' steps: - name: Set up Go 1.x @@ -31,7 +36,8 @@ jobs: windows-msi: name: Build Windows MSI and upload to release runs-on: ubuntu-latest - # needs: [release] + needs: [release] + if: needs.release.result == 'success' || needs.release.result == 'skipped' env: INSTALLER: ${{ github.workspace }}/.github/win-msi BIN: ${{ github.workspace }}/.github/win-msi/src/bin From 9bf90ceffa719479cfd94dc2a568a1103868e78b Mon Sep 17 00:00:00 2001 From: Brian Scholer <1260690+briantist@users.noreply.github.com> Date: Thu, 3 Feb 2022 18:15:12 -0500 Subject: [PATCH 11/16] better description --- .github/workflows/release.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 8cbe77178..4684a3b9e 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -7,7 +7,7 @@ on: workflow_dispatch: inputs: tag: - description: The tag to run against. If release exists, only the MSI builder runs. + description: The tag to run against. This trigger only runs the MSI builder. required: true jobs: From ad42b302a5e3d5db99f66489741109c637b67b98 Mon Sep 17 00:00:00 2001 From: Brian Scholer <1260690+briantist@users.noreply.github.com> Date: Thu, 3 Feb 2022 18:18:46 -0500 Subject: [PATCH 12/16] needs conditional --- .github/workflows/release.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 4684a3b9e..cd0a95b97 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -37,7 +37,9 @@ jobs: name: Build Windows MSI and upload to release runs-on: ubuntu-latest needs: [release] - if: needs.release.result == 'success' || needs.release.result == 'skipped' + 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 From 106519e861974fcb38dda728e92e898df7d04426 Mon Sep 17 00:00:00 2001 From: Brian Scholer <1260690+briantist@users.noreply.github.com> Date: Thu, 3 Feb 2022 18:23:22 -0500 Subject: [PATCH 13/16] tag fixups --- .github/workflows/release.yml | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index cd0a95b97..1d115182d 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -45,10 +45,16 @@ jobs: BIN: ${{ github.workspace }}/.github/win-msi/src/bin WIXIMG: dactiv/wix@sha256:17d232708589641f5632f9a1ff9463ad087b192cea7b8e6012d2b47ec6af5f6c steps: - - name: Strip v from version tag + - name: Normalize tag values run: | - VER=${GITHUB_REF/refs\/tags\//} + 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 @@ -79,4 +85,5 @@ jobs: - name: Upload the asset to the release uses: softprops/action-gh-release@1e07f4398721186383de40550babbdf2b84acfc5 # v0.1.14 / v1 with: + tag_name: ${{ env.VER_TAG }} files: ${{ env.INSTALLER }}/out/*.msi From 430d80fc7346f28bbe1cd2ef5b11edf1b1dddec5 Mon Sep 17 00:00:00 2001 From: Brian Scholer <1260690+briantist@users.noreply.github.com> Date: Thu, 3 Feb 2022 18:25:12 -0500 Subject: [PATCH 14/16] bash me --- .github/workflows/release.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 1d115182d..d1ddec7b3 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -47,7 +47,7 @@ jobs: steps: - name: Normalize tag values run: | - if [[ "${{ github.event_name }}" == "workflow_dispatch "]] ; then + if [[ "${{ github.event_name }}" == "workflow_dispatch" ]] ; then VER=${{ github.event.inputs.tag }} else VER=${GITHUB_REF/refs\/tags\//} From 2ce9149a092b48b4e4a83be55695484d37b2e68b Mon Sep 17 00:00:00 2001 From: Brian Scholer <1260690+briantist@users.noreply.github.com> Date: Tue, 3 May 2022 17:44:53 -0400 Subject: [PATCH 15/16] Update .github/workflows/release.yml --- .github/workflows/release.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index d1ddec7b3..dbaee85e6 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -60,7 +60,7 @@ jobs: echo "ASSET=saml2aws_${VERSION}_windows_amd64.zip" >> $GITHUB_ENV - name: Check out code - uses: actions/checkout@v2 + uses: actions/checkout@v3 - name: Retrieve the release asset id: asset From b1ea91909bd22c717009db2b751e2c54a27e648d Mon Sep 17 00:00:00 2001 From: Brian Scholer <1260690+briantist@users.noreply.github.com> Date: Mon, 6 Mar 2023 14:48:52 -0500 Subject: [PATCH 16/16] bump action versions --- .github/workflows/release.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 01fe904a8..97b0a5f6a 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -76,7 +76,7 @@ jobs: - name: Retrieve the release asset id: asset - uses: robinraju/release-downloader@4bdb8ee081c9ee08a35320794dd461312ac9e4ad # v1.3 + uses: robinraju/release-downloader@768b85c8d69164800db5fc00337ab917daf3ce68 # v1.7 with: repository: ${{ github.repository }} tag: ${{ env.VER_TAG }} @@ -95,7 +95,7 @@ jobs: 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@1e07f4398721186383de40550babbdf2b84acfc5 # v0.1.14 / v1 + uses: softprops/action-gh-release@de2c0eb89ae2a093876385947365aca7b0e5f844 # v0.1.15 / v1 with: tag_name: ${{ env.VER_TAG }} files: ${{ env.INSTALLER }}/out/*.msi