Skip to content

Commit 09354e7

Browse files
authored
Add msi release
1 parent 7c7c767 commit 09354e7

File tree

1 file changed

+48
-0
lines changed

1 file changed

+48
-0
lines changed

.github/workflows/release.yaml

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,3 +38,51 @@ jobs:
3838
args: release --rm-dist
3939
env:
4040
GITHUB_TOKEN: ${{ secrets.GH_PUBLISH_SECRETS }}
41+
42+
msi:
43+
needs: goreleaser
44+
runs-on: windows-latest
45+
steps:
46+
- name: Checkout
47+
uses: actions/checkout@v2
48+
- name: Download hd.exe
49+
id: download_exe
50+
shell: bash
51+
run: |
52+
hub release download "${GITHUB_REF#refs/tags/}" -i '*windows_amd64*.zip'
53+
printf "::set-output name=zip::%s\n" *.zip
54+
unzip -o *.zip && rm -v *.zip
55+
env:
56+
GITHUB_TOKEN: ${{secrets.GH_PUBLISH_SECRETS}}
57+
- name: Install go-msi
58+
run: choco install -y "go-msi"
59+
- name: Prepare PATH
60+
shell: bash
61+
run: |
62+
echo "$WIX\\bin" >> $GITHUB_PATH
63+
echo "C:\\Program Files\\go-msi" >> $GITHUB_PATH
64+
- name: Build MSI
65+
id: buildmsi
66+
shell: bash
67+
env:
68+
ZIP_FILE: ${{ steps.download_exe.outputs.zip }}
69+
run: |
70+
mkdir -p build
71+
msi="$(basename "$ZIP_FILE" ".zip").msi"
72+
printf "::set-output name=msi::%s\n" "$msi"
73+
go-msi make --msi "$PWD/$msi" --out "$PWD/build" --version "${GITHUB_REF#refs/tags/}"
74+
- name: Upload MSI
75+
shell: bash
76+
run: |
77+
tag_name="${GITHUB_REF#refs/tags/}"
78+
hub release edit "$tag_name" -m "" -a "$MSI_FILE"
79+
release_url="$(gh api repos/:owner/:repo/releases -q ".[]|select(.tag_name==\"${tag_name}\")|.url")"
80+
publish_args=( -F draft=false )
81+
if [[ $GITHUB_REF != *-* ]]; then
82+
publish_args+=( -f discussion_category_name="$DISCUSSION_CATEGORY" )
83+
fi
84+
gh api -X PATCH "$release_url" "${publish_args[@]}"
85+
env:
86+
MSI_FILE: ${{ steps.buildmsi.outputs.msi }}
87+
DISCUSSION_CATEGORY: General
88+
GITHUB_TOKEN: ${{secrets.GH_PUBLISH_SECRETS}}

0 commit comments

Comments
 (0)