diff --git a/.github/workflows/development.yml b/.github/workflows/development.yml index cd93e590..2a826d54 100644 --- a/.github/workflows/development.yml +++ b/.github/workflows/development.yml @@ -58,6 +58,15 @@ jobs: go mod tidy go build -trimpath -ldflags "-s -w" -o eventsearcher.exe cd ../.. + mkdir arm64 + $Env:CGO_ENABLED='0' + $Env:GOOS='windows' + $Env:GOARCH='arm64' + go-winres simply --arch arm64 --product-version $LATEST_TAG-dev-$GIT_COMMIT --file-version $FILE_VERSION --file-description "SFTPGo server" --product-name SFTPGo --copyright "AGPL-3.0" --original-filename sftpgo.exe --icon .\windows-installer\icon.ico + go build -trimpath -ldflags "-s -w -X github.com/drakkan/sftpgo/v2/version.commit=$GIT_COMMIT -X github.com/drakkan/sftpgo/v2/version.date=$DATE_TIME" -o .\arm64\sftpgo.exe + Remove-Item Env:\CGO_ENABLED + Remove-Item Env:\GOOS + Remove-Item Env:\GOARCH - name: Run test cases using SQLite provider run: go test -v -p 1 -timeout 15m ./... -coverprofile=coverage.txt -covermode=atomic @@ -129,27 +138,50 @@ jobs: certutil -f -p "$Env:CERT_PASS" -importpfx MY "$CERT_PATH" rm "$CERT_PATH" & 'C:/Program Files (x86)/Windows Kits/10/bin/10.0.17763.0/x86/signtool.exe' sign /sm /tr http://timestamp.sectigo.com /td sha256 /fd sha256 /n "Nicola Murino" /d "SFTPGo" .\sftpgo.exe + & 'C:/Program Files (x86)/Windows Kits/10/bin/10.0.17763.0/x86/signtool.exe' sign /sm /tr http://timestamp.sectigo.com /td sha256 /fd sha256 /n "Nicola Murino" /d "SFTPGo" .\arm64\sftpgo.exe $INNO_S='/Ssigntool=$qC:/Program Files (x86)/Windows Kits/10/bin/10.0.17763.0/x86/signtool.exe$q sign /sm /tr http://timestamp.sectigo.com /td sha256 /fd sha256 /n $qNicola Murino$q /d $qSFTPGo$q $f' iscc "$INNO_S" .\windows-installer\sftpgo.iss + + rm .\output\sftpgo.exe + rm .\output\sftpgo.db + copy .\arm64\sftpgo.exe .\output + (Get-Content .\output\sftpgo.json).replace('"sqlite"', '"bolt"') | Set-Content .\output\sftpgo.json + $Env:SFTPGO_DATA_PROVIDER__DRIVER='bolt' + $Env:SFTPGO_DATA_PROVIDER__NAME='.\output\sftpgo.db' + .\sftpgo.exe initprovider + Remove-Item Env:\SFTPGO_DATA_PROVIDER__DRIVER + Remove-Item Env:\SFTPGO_DATA_PROVIDER__NAME + $Env:SFTPGO_ISS_ARCH='arm64' + iscc "$INNO_S" .\windows-installer\sftpgo.iss certutil -delstore MY "Nicola Murino" env: CERT_DATA: ${{ secrets.CERT_DATA }} CERT_PASS: ${{ secrets.CERT_PASS }} - - name: Upload Windows installer artifact + - name: Upload Windows installer x86_64 artifact if: ${{ startsWith(matrix.os, 'windows-') && github.event_name != 'pull_request' }} uses: actions/upload-artifact@v2 with: name: sftpgo_windows_installer_x86_64 path: ./sftpgo_windows_x86_64.exe + - name: Upload Windows installer arm64 artifact + if: ${{ startsWith(matrix.os, 'windows-') && github.event_name != 'pull_request' }} + uses: actions/upload-artifact@v2 + with: + name: sftpgo_windows_installer_arm64 + path: ./sftpgo_windows_arm64.exe + - name: Prepare build artifact for Windows if: startsWith(matrix.os, 'windows-') run: | Remove-Item -LiteralPath "output" -Force -Recurse -ErrorAction Ignore mkdir output copy .\sftpgo.exe .\output + mkdir output\arm64 + copy .\arm64\sftpgo.exe .\output\arm64 copy .\sftpgo.json .\output + (Get-Content .\output\sftpgo.json).replace('"sqlite"', '"bolt"') | Set-Content .\output\sftpgo.json mkdir output\templates xcopy .\templates .\output\templates\ /E mkdir output\static diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 9b24b0df..438426b2 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -86,6 +86,15 @@ jobs: go install github.com/tc-hib/go-winres@latest go-winres simply --arch amd64 --product-version $Env:SFTPGO_VERSION-$GIT_COMMIT --file-version $FILE_VERSION --file-description "SFTPGo server" --product-name SFTPGo --copyright "AGPL-3.0" --original-filename sftpgo.exe --icon .\windows-installer\icon.ico go build -trimpath -ldflags "-s -w -X github.com/drakkan/sftpgo/v2/version.commit=$GIT_COMMIT -X github.com/drakkan/sftpgo/v2/version.date=$DATE_TIME" -o sftpgo.exe + mkdir arm64 + $Env:CGO_ENABLED='0' + $Env:GOOS='windows' + $Env:GOARCH='arm64' + go-winres simply --arch arm64 --product-version $Env:SFTPGO_VERSION-$GIT_COMMIT --file-version $FILE_VERSION --file-description "SFTPGo server" --product-name SFTPGo --copyright "AGPL-3.0" --original-filename sftpgo.exe --icon .\windows-installer\icon.ico + go build -trimpath -ldflags "-s -w -X github.com/drakkan/sftpgo/v2/version.commit=$GIT_COMMIT -X github.com/drakkan/sftpgo/v2/version.date=$DATE_TIME" -o .\arm64\sftpgo.exe + Remove-Item Env:\CGO_ENABLED + Remove-Item Env:\GOOS + Remove-Item Env:\GOARCH env: SFTPGO_VERSION: ${{ steps.get_version.outputs.VERSION }} @@ -142,8 +151,21 @@ jobs: certutil -f -p "$Env:CERT_PASS" -importpfx MY "$CERT_PATH" rm "$CERT_PATH" & 'C:/Program Files (x86)/Windows Kits/10/bin/10.0.17763.0/x86/signtool.exe' sign /sm /tr http://timestamp.sectigo.com /td sha256 /fd sha256 /n "Nicola Murino" /d "SFTPGo" .\sftpgo.exe + & 'C:/Program Files (x86)/Windows Kits/10/bin/10.0.17763.0/x86/signtool.exe' sign /sm /tr http://timestamp.sectigo.com /td sha256 /fd sha256 /n "Nicola Murino" /d "SFTPGo" .\arm64\sftpgo.exe $INNO_S='/Ssigntool=$qC:/Program Files (x86)/Windows Kits/10/bin/10.0.17763.0/x86/signtool.exe$q sign /sm /tr http://timestamp.sectigo.com /td sha256 /fd sha256 /n $qNicola Murino$q /d $qSFTPGo$q $f' iscc "$INNO_S" .\windows-installer\sftpgo.iss + + rm .\output\sftpgo.exe + rm .\output\sftpgo.db + copy .\arm64\sftpgo.exe .\output + (Get-Content .\output\sftpgo.json).replace('"sqlite"', '"bolt"') | Set-Content .\output\sftpgo.json + $Env:SFTPGO_DATA_PROVIDER__DRIVER='bolt' + $Env:SFTPGO_DATA_PROVIDER__NAME='.\output\sftpgo.db' + .\sftpgo.exe initprovider + Remove-Item Env:\SFTPGO_DATA_PROVIDER__DRIVER + Remove-Item Env:\SFTPGO_DATA_PROVIDER__NAME + $Env:SFTPGO_ISS_ARCH='arm64' + iscc "$INNO_S" .\windows-installer\sftpgo.iss certutil -delstore MY "Nicola Murino" env: SFTPGO_ISS_VERSION: ${{ steps.get_version.outputs.VERSION }} @@ -156,8 +178,11 @@ jobs: run: | mkdir win-portable copy .\sftpgo.exe .\win-portable + mkdir win-portable\arm64 + copy .\arm64\sftpgo.exe .\win-portable\arm64\sftpgo.exe copy .\sftpgo.json .\win-portable - copy .\sftpgo.db .\win-portable + (Get-Content .\win-portable\sftpgo.json).replace('"sqlite"', '"bolt"') | Set-Content .\win-portable\sftpgo.json + copy .\output\sftpgo.db .\win-portable copy .\LICENSE .\win-portable\LICENSE.txt mkdir win-portable\templates xcopy .\templates .\win-portable\templates\ /E @@ -165,7 +190,7 @@ jobs: xcopy .\static .\win-portable\static\ /E mkdir win-portable\openapi xcopy .\openapi .\win-portable\openapi\ /E - Compress-Archive .\win-portable\* sftpgo_portable_x86_64.zip + Compress-Archive .\win-portable\* sftpgo_portable.zip - name: Upload macOS x86_64 artifact if: startsWith(matrix.os, 'macos-') @@ -183,7 +208,7 @@ jobs: path: ./sftpgo_${{ steps.get_version.outputs.VERSION }}_${{ steps.get_os_name.outputs.OS }}_arm64.tar.xz retention-days: 1 - - name: Upload Windows installer artifact + - name: Upload Windows installer x86_64 artifact if: startsWith(matrix.os, 'windows-') uses: actions/upload-artifact@v2 with: @@ -191,12 +216,20 @@ jobs: path: ./sftpgo_windows_x86_64.exe retention-days: 1 + - name: Upload Windows installer arm64 artifact + if: startsWith(matrix.os, 'windows-') + uses: actions/upload-artifact@v2 + with: + name: sftpgo_${{ steps.get_version.outputs.VERSION }}_${{ steps.get_os_name.outputs.OS }}_arm64.exe + path: ./sftpgo_windows_arm64.exe + retention-days: 1 + - name: Upload Windows portable artifact if: startsWith(matrix.os, 'windows-') uses: actions/upload-artifact@v2 with: - name: sftpgo_${{ steps.get_version.outputs.VERSION }}_${{ steps.get_os_name.outputs.OS }}_portable_x86_64.zip - path: ./sftpgo_portable_x86_64.zip + name: sftpgo_${{ steps.get_version.outputs.VERSION }}_${{ steps.get_os_name.outputs.OS }}_portable.zip + path: ./sftpgo_portable.zip retention-days: 1 prepare-linux: @@ -504,10 +537,15 @@ jobs: with: name: sftpgo_${{ steps.get_version.outputs.SFTPGO_VERSION }}_windows_x86_64.exe - - name: Download Windows portable x86_64 artifact + - name: Download Windows installer arm64 artifact uses: actions/download-artifact@v2 with: - name: sftpgo_${{ steps.get_version.outputs.SFTPGO_VERSION }}_windows_portable_x86_64.zip + name: sftpgo_${{ steps.get_version.outputs.SFTPGO_VERSION }}_windows_arm64.exe + + - name: Download Windows portable artifact + uses: actions/download-artifact@v2 + with: + name: sftpgo_${{ steps.get_version.outputs.SFTPGO_VERSION }}_windows_portable.zip - name: Download source with deps artifact uses: actions/download-artifact@v2 @@ -517,7 +555,8 @@ jobs: - name: Create release run: | mv sftpgo_windows_x86_64.exe sftpgo_${SFTPGO_VERSION}_windows_x86_64.exe - mv sftpgo_portable_x86_64.zip sftpgo_${SFTPGO_VERSION}_windows_portable_x86_64.zip + mv sftpgo_windows_arm64.exe sftpgo_${SFTPGO_VERSION}_windows_arm64.exe + mv sftpgo_portable.zip sftpgo_${SFTPGO_VERSION}_windows_portable.zip gh release create "${SFTPGO_VERSION}" -t "${SFTPGO_VERSION}" gh release upload "${SFTPGO_VERSION}" sftpgo_*.xz --clobber gh release upload "${SFTPGO_VERSION}" sftpgo-*.rpm --clobber diff --git a/go.mod b/go.mod index 6211a64a..85560cdc 100644 --- a/go.mod +++ b/go.mod @@ -129,7 +129,7 @@ require ( golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1 // indirect google.golang.org/appengine v1.6.7 // indirect google.golang.org/genproto v0.0.0-20211118181313-81c1377c94b1 // indirect - gopkg.in/ini.v1 v1.64.0 // indirect + gopkg.in/ini.v1 v1.65.0 // indirect gopkg.in/yaml.v2 v2.4.0 // indirect gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b // indirect ) diff --git a/go.sum b/go.sum index d08e5c11..2cff2938 100644 --- a/go.sum +++ b/go.sum @@ -1250,8 +1250,8 @@ gopkg.in/go-playground/validator.v9 v9.29.1/go.mod h1:+c9/zcJMFNgbLvly1L1V+PpxWd gopkg.in/inconshreveable/log15.v2 v2.0.0-20180818164646-67afb5ed74ec/go.mod h1:aPpfJ7XW+gOuirDoZ8gHhLh3kZ1B08FtV2bbmy7Jv3s= gopkg.in/ini.v1 v1.62.0/go.mod h1:pNLf8WUiyNEtQjuu5G5vTm06TEv9tsIgeAvK8hOrP4k= gopkg.in/ini.v1 v1.63.2/go.mod h1:pNLf8WUiyNEtQjuu5G5vTm06TEv9tsIgeAvK8hOrP4k= -gopkg.in/ini.v1 v1.64.0 h1:Mj2zXEXcNb5joEiSA0zc3HZpTst/iyjNiR4CN8tDzOg= -gopkg.in/ini.v1 v1.64.0/go.mod h1:pNLf8WUiyNEtQjuu5G5vTm06TEv9tsIgeAvK8hOrP4k= +gopkg.in/ini.v1 v1.65.0 h1:B2//IEITFk89S+Nl2tozBeqUvFEpUAY6daarSlrx8jU= +gopkg.in/ini.v1 v1.65.0/go.mod h1:pNLf8WUiyNEtQjuu5G5vTm06TEv9tsIgeAvK8hOrP4k= gopkg.in/natefinch/lumberjack.v2 v2.0.0 h1:1Lc07Kr7qY4U2YPouBjpCLxpiyxIVoxqXgkXLknAOE8= gopkg.in/natefinch/lumberjack.v2 v2.0.0/go.mod h1:l0ndWWf7gzL7RNwBG7wST/UCcT4T24xpD6X8LsfU/+k= gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7/go.mod h1:dt/ZhP58zS4L8KSrWDmTeBkI65Dw0HsyUHuEVlX15mw= diff --git a/windows-installer/sftpgo.iss b/windows-installer/sftpgo.iss index 0252273e..344213ce 100644 --- a/windows-installer/sftpgo.iss +++ b/windows-installer/sftpgo.iss @@ -4,6 +4,13 @@ #else #define MyAppVersion GetEnv("SFTPGO_ISS_DEV_VERSION") #endif +#if GetEnv("SFTPGO_ISS_ARCH") != "" + #define MyAppArch GetEnv("SFTPGO_ISS_ARCH") + #define MySetupName "sftpgo_windows_" + MyAppArch +#else + #define MyAppArch "x64" + #define MySetupName "sftpgo_windows_x86_64" +#endif #define MyAppURL "https://github.com/drakkan/sftpgo" #define MyVersionInfo StringChange(MyAppVersion,"v","") #if GetEnv("SFTPGO_ISS_DOC_URL") != "" @@ -20,6 +27,7 @@ AppId={{1FB9D57F-00DD-4B1B-8798-1138E5CE995D} AppName={#MyAppName} AppVersion={#MyAppVersion} AppVerName={#MyAppName} {#MyAppVersion} +AppPublisher=Nicola Murino AppPublisherURL={#MyAppURL} AppSupportURL={#MyAppURL} AppUpdatesURL={#MyAppURL} @@ -28,14 +36,14 @@ DefaultDirName={autopf}\{#MyAppName} DefaultGroupName={#MyAppName} LicenseFile={#MyAppDir}\LICENSE.txt OutputDir={#MyOutputDir} -OutputBaseFilename=sftpgo_windows_x86_64 +OutputBaseFilename={#MySetupName} SetupIconFile=icon.ico SolidCompression=yes UninstallDisplayIcon={app}\sftpgo.exe WizardStyle=modern -ArchitecturesInstallIn64BitMode=x64 +ArchitecturesInstallIn64BitMode={#MyAppArch} PrivilegesRequired=admin -ArchitecturesAllowed=x64 +ArchitecturesAllowed={#MyAppArch} MinVersion=6.1sp1 VersionInfoVersion={#MyVersionInfo} VersionInfoCopyright=AGPL-3.0