Skip to content

Commit

Permalink
Adds Windows Installer (MSI) to the release
Browse files Browse the repository at this point in the history
This adds func-e.msi manually until goreleaser/goreleaser#1295

This also adds basic testing of the msi as a part of e2e.

Signed-off-by: Adrian Cole <[email protected]>
  • Loading branch information
Adrian Cole committed Aug 6, 2021
1 parent 46043db commit f77067a
Showing 1 changed file with 32 additions and 3 deletions.
35 changes: 32 additions & 3 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,20 @@ jobs:
go-version: ${{ env.GO_VERSION }}

- name: "Run GoReleaser"
run: make release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: "Add Windows installer (func-e.msi) to release"
run: | # manually until https://github.com/goreleaser/goreleaser/issues/1295
tag="${GITHUB_REF#refs/tags/}"
version=${tag#v}
VERSION=${version} make msi
msi=dist/func-e_${version}_windows_amd64.msi
mv dist/func-e_windows_amd64/func-e.msi ${msi}
gh release upload "${tag}" "${msi}"
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: make release

e2e:
needs: func-e
Expand All @@ -44,8 +55,10 @@ jobs:
- os: macos-latest
pattern: '*darwin_amd64.tar.gz'
- os: windows-latest
pattern: '*windows_amd64.zip'
unzip: unzip -o *.zip && rm *.zip
pattern: '*windows_amd64.*'
unzip: | # the above downloads both the zip and msi, stash the msi name
printf "::set-output name=msi::%s\n" *.msi
unzip -o *.zip && rm *.zip
defaults:
run: # use bash for all operating systems unless overridden
Expand All @@ -61,6 +74,7 @@ jobs:
go-version: ${{ env.GO_VERSION }}

- name: "Extract `func-e` binary from GitHub release assets"
id: download # allows variables like ${{ steps.download.outputs.X }}
run: |
gh release download "${GITHUB_REF#refs/tags/}" -p '${{ matrix.pattern }}'
${{ matrix.unzip || tar -xzf *.tar.gz && rm *.tar.gz }}
Expand All @@ -70,6 +84,21 @@ jobs:
- name: "Run e2e tests using released `func-e` binary"
run: go test -parallel 1 -v -failfast ./e2e

# This only checks the installer when built on Windows as it is simpler than switching OS.
# refreshenv is from choco, and lets you reload ENV variables (used here for PATH).
- name: "Test Windows Installer (Windows)"
if: runner.os == 'Windows'
run: | # install, try something, uninstall
msiexec /i %MSI_FILE% /qn
refreshenv
func-e -version
msiexec /x %MSI_FILE% /qn
func-e -version && exit 1
del %MSI_FILE%
shell: cmd
env: # use the stashed msi name instead of parsing in cmd
MSI_FILE: ${{ steps.download.outputs.msi }}

homebrew:
needs: e2e
name: Bump homebrew-core formula
Expand Down

0 comments on commit f77067a

Please sign in to comment.