aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLaurence Kedward <laurence.kedward@bristol.ac.uk>2021-11-21 15:05:31 +0000
committerGitHub <noreply@github.com>2021-11-21 16:05:31 +0100
commit3db95d9cb2bf3bda80bdd985dd0019bec0d0c85b (patch)
tree1483863471722512ac9308ec64c8ebae6ab46cb4
parent9dc068d256da43085582956626881461ffdcd356 (diff)
downloadfpm-3db95d9cb2bf3bda80bdd985dd0019bec0d0c85b.tar.gz
fpm-3db95d9cb2bf3bda80bdd985dd0019bec0d0c85b.zip
Add: files and workflow to make installer on release. (#616)
-rw-r--r--.github/workflows/CI.yml77
-rw-r--r--ci/fpm-installer.nsi112
-rw-r--r--ci/installer-icon.icobin0 -> 16958 bytes
3 files changed, 189 insertions, 0 deletions
diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml
index f36cf2b..2d951dc 100644
--- a/.github/workflows/CI.yml
+++ b/.github/workflows/CI.yml
@@ -166,11 +166,88 @@ jobs:
name: ${{ env.FPM_RELEASE }}
path: ${{ env.FPM_RELEASE }}
+
+ make-installer:
+ if: ${{ github.event_name == 'release' && contains(github.ref, 'v') || github.event_name == 'push' }}
+ runs-on: windows-latest
+ needs:
+ - build
+
+ steps:
+ - uses: actions/checkout@v2
+
+ - name: Download Artifacts
+ uses: actions/download-artifact@v2
+ with:
+ path: ${{ github.workspace }} # This will download all files
+
+ - name: Get version (normal)
+ if: github.event_name != 'release'
+ shell: bash
+ run: |
+ VERSION=$(git rev-parse --short HEAD)
+ echo "VERSION=$VERSION" >> $GITHUB_ENV
+
+ - name: Get version (release)
+ if: github.event_name == 'release'
+ shell: bash
+ run: |
+ VERSION=$(echo ${{ github.ref }} | cut -dv -f2)
+ echo "VERSION=$VERSION" >> $GITHUB_ENV
+ env:
+ REGEX: '[0-9]\{1,4\}\.[0-9]\{1,4\}\.[0-9]\{1,4\}'
+
+ - name: Setup MinGW (MSYS2)
+ uses: msys2/setup-msys2@v2
+ with:
+ msystem: MINGW64
+ update: false
+ install: >-
+ wget
+ unzip
+
+ - name: Fetch Windows executable
+ shell: msys2 {0}
+ run: |
+ cp fpm-*/fpm*.exe ./ci/fpm.exe
+
+ - name: Fetch Git for Windows
+ shell: msys2 {0}
+ run: |
+ cd ./ci
+ wget ${{ env.git_download }} -O MinGit.zip
+ unzip MinGit.zip -d MinGit
+ env:
+ git_download: "https://github.com/git-for-windows/git/releases/download/v2.33.1.windows.1/MinGit-2.33.1-64-bit.zip"
+
+ - name: Fetch EnVar Plugin for NSIS
+ shell: msys2 {0}
+ run: |
+ cd ./ci
+ wget ${{ env.envar_download }} -O EnVar-Plugin.zip
+ mkdir EnVar_plugin
+ unzip EnVar-Plugin.zip -d EnVar_plugin
+ env:
+ envar_download: "https://github.com/GsNSIS/EnVar/releases/download/v0.3.1/EnVar-Plugin.zip"
+
+ - name: Generate installer
+ run: |
+ cd ./ci
+ makensis fpm-installer.nsi
+ move fpm-installer.exe fpm-installer-${{ env.VERSION }}.exe
+
+ - name: Upload artifact
+ uses: actions/upload-artifact@v2
+ with:
+ name: fpm-installer
+ path: ci/fpm-installer-${{ env.VERSION }}.exe
+
upload-artifacts:
if: ${{ github.event_name == 'release' && contains(github.ref, 'v') || github.event_name == 'push' }}
runs-on: ubuntu-latest
needs:
- build
+ - make-installer
steps:
- id: deploy-on-push
diff --git a/ci/fpm-installer.nsi b/ci/fpm-installer.nsi
new file mode 100644
index 0000000..0c0243b
--- /dev/null
+++ b/ci/fpm-installer.nsi
@@ -0,0 +1,112 @@
+; NSIS Installer script for the Fortran Package Manager
+
+; ---------------- Properties ----------------
+; Name used in installer GUI
+Name "Fortran Package Manager"
+
+; Name for folder location and reg key
+!define INSTALL_NAME "fortran-lang"
+
+; Installer icon
+!define MUI_ICON "installer-icon.ico"
+
+; Compress installer
+SetCompress auto
+
+; Always produce unicode installer
+Unicode true
+
+; ---------------- Setup ----------------
+; Use EnVar plugin (https://nsis.sourceforge.io/EnVar_plug-in)
+!addplugindir ".\EnVar_plugin\Plugins\x86-unicode"
+
+; Use the 'Modern' Installer UI macros
+!include "MUI2.nsh"
+
+; Default installation folder (local)
+InstallDir "$LOCALAPPDATA\${INSTALL_NAME}"
+
+; Get installation folder from registry if available
+InstallDirRegKey HKCU "Software\${INSTALL_NAME}" ""
+
+; Request application privileges
+RequestExecutionLevel user
+
+
+; ---------------- Installer Pages ----------------
+!insertmacro MUI_PAGE_COMPONENTS
+!insertmacro MUI_PAGE_DIRECTORY
+!insertmacro MUI_PAGE_INSTFILES
+
+
+; ---------------- Uninstaller Pages ----------------
+!insertmacro MUI_UNPAGE_CONFIRM
+!insertmacro MUI_UNPAGE_INSTFILES
+
+
+; MUI Language
+!insertmacro MUI_LANGUAGE "English"
+
+
+; ---------------- Component: Core Installation ----------------
+Section "-Core" SecCore
+
+ SetOutPath "$INSTDIR"
+
+ ; Store installation folder
+ WriteRegStr HKCU "Software\${INSTALL_NAME}" "" $INSTDIR
+
+ ; Create uninstaller
+ WriteUninstaller "$INSTDIR\Uninstall.exe"
+
+ ; Add to path
+ EnVar::SetHKCU
+ EnVar::AddValue "PATH" "$INSTDIR\fpm"
+ EnVar::AddValue "PATH" "$INSTDIR\MinGit\mingw64\bin"
+
+SectionEnd
+
+
+; ---------------- Component: fpm ----------------
+Section "FPM" SecFPM
+
+ SetOutPath "$INSTDIR\fpm"
+
+ File "fpm.exe"
+
+SectionEnd
+
+
+; ---------------- Component: Git ----------------
+Section "Git for Windows" SecGit
+
+ SetOutPath "$INSTDIR"
+
+ File /r "MinGit"
+
+SectionEnd
+
+
+; ---------------- Uninstaller ----------------
+Section "Uninstall"
+
+ RMDir /r "$INSTDIR"
+
+ DeleteRegKey /ifempty HKCU "Software\${INSTALL_NAME}"
+
+ EnVar::SetHKCU
+ EnVar::DeleteValue "PATH" "$INSTDIR\fpm"
+ EnVar::DeleteValue "PATH" "$INSTDIR\MinGit\mingw64\bin"
+
+SectionEnd
+
+
+; ---------------- Component description Strings (EN) ----------------
+LangString DESC_SecFPM ${LANG_ENGLISH} "The Fortran Package Manager"
+LangString DESC_SecGit ${LANG_ENGLISH} "Git version control (required for FPM)"
+
+
+!insertmacro MUI_FUNCTION_DESCRIPTION_BEGIN
+ !insertmacro MUI_DESCRIPTION_TEXT ${SecFPM} $(DESC_SecFPM)
+ !insertmacro MUI_DESCRIPTION_TEXT ${SecGit} $(DESC_SecGit)
+!insertmacro MUI_FUNCTION_DESCRIPTION_END
diff --git a/ci/installer-icon.ico b/ci/installer-icon.ico
new file mode 100644
index 0000000..a360390
--- /dev/null
+++ b/ci/installer-icon.ico
Binary files differ