Skip to content

Commit

Permalink
scripting windows installer generation for ci/cd pipeline
Browse files Browse the repository at this point in the history
  • Loading branch information
garethgeorge committed May 24, 2024
1 parent 3759603 commit aba7ada
Show file tree
Hide file tree
Showing 4 changed files with 56 additions and 4 deletions.
31 changes: 31 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -52,3 +52,34 @@ jobs:
with:
name: release-artifacts
path: dist/*

tagged-release-installers:
name: "Tagged Release Installers"
runs-on: "ubuntu-latest"
needs: tagged-release

steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0

- name: Get Release Artifact URL # used to append installer executables to the release after GoReleaser runs
id: geturl
run: |
upload_url=$(curl -sL https://api.github.com/repos/${{github.repository}}/releases/latest?access_token=${{ secrets.GITHUB_TOKEN }} | jq -r '.upload_url')
echo ::set-output name=upload_url::$upload_url
- name: Generate Installers
run: |
./scripts/generate-installers.sh
- name: Upload Release Asset
id: upload-release-asset
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.geturl.outputs.upload_url }}
asset_path: ./my-artifact.zip
asset_name: my-artifact.zip
asset_content_type: application/zip
Empty file removed build/windows/LICENSE.txt
Empty file.
8 changes: 4 additions & 4 deletions build/windows/install.nsi
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
!define BUILD_DIR "."
!define OUT_DIR ".\dist\"
!define OUT_DIR "."
!define APP_NAME "Backrest"
!define COMP_NAME "garethgeorge"
!define WEB_SITE "https://github.com/garethgeorge/backrest"
!define VERSION "00.00.00.00"
!define COPYRIGHT "garethgeorge 2024"
!define DESCRIPTION "Application"
!define LICENSE_TXT "${BUILD_DIR}\LICENSE.txt"
!define LICENSE_TXT "${BUILD_DIR}\LICENSE"
!define INSTALLER_NAME "${OUT_DIR}\Backrest-setup.exe"
!define MAIN_APP_EXE "backrest.exe"
!define INSTALL_TYPE "SetShellVarContext current"
Expand Down Expand Up @@ -81,7 +81,7 @@ ${INSTALL_TYPE}
SetOverwrite ifnewer
SetOutPath "$INSTDIR"
File "${BUILD_DIR}\backrest.exe"
File "${BUILD_DIR}\LICENSE.txt"
File "${BUILD_DIR}\LICENSE"
SectionEnd

######################################################################
Expand Down Expand Up @@ -139,7 +139,7 @@ SectionEnd
Section Uninstall
${INSTALL_TYPE}
Delete "$INSTDIR\backrest.exe"
Delete "$INSTDIR\LICENSE.txt"
Delete "$INSTDIR\LICENSE"
Delete "$INSTDIR\uninstall.exe"
Delete "$SMSTARTUP\$(^Name).lnk"
!ifdef WEB_SITE
Expand Down
21 changes: 21 additions & 0 deletions scripts/generate-installers.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
#! /bin/bash

outdir=$(realpath $1)
srcdir=$(realpath $(dirname $0)/..)

# for each supported windows architecture
for arch in x86_64 arm64; do
cd $(mktemp -d)
wget https://github.com/garethgeorge/backrest/releases/latest/download/backrest_Windows_${arch}.zip
unzip backrest_Windows_${arch}.zip

cp -rl $srcdir/build/windows/* .

if [ "$arch" == "x86_64" ]; then
docker run --rm -v $(pwd):/build binfalse/nsis install.nsi
else
docker run --rm -e TARGET_ARCH=arm64 -v $(pwd):/build binfalse/nsis install.nsi
fi

cp Backrest-setup.exe $outdir/Backrest-setup-${arch}.exe
done

0 comments on commit aba7ada

Please sign in to comment.