From d16a07740deff8bfddd6e8e581352bbf35f8d378 Mon Sep 17 00:00:00 2001 From: xEricL <37921711+xEricL@users.noreply.github.com> Date: Mon, 9 Sep 2024 03:38:08 -0400 Subject: [PATCH] set PrivilegesRequired=lowest --- .github/workflows/go-build.yml | 622 +++++++++++----------- pkg/windows/iss/PackagePinnacle-amd64.iss | 1 + pkg/windows/iss/PackagePinnacle-arm64.iss | 1 + 3 files changed, 312 insertions(+), 312 deletions(-) diff --git a/.github/workflows/go-build.yml b/.github/workflows/go-build.yml index 85c0660..6bbc330 100644 --- a/.github/workflows/go-build.yml +++ b/.github/workflows/go-build.yml @@ -5,8 +5,6 @@ on: branches: - 'master' - 'test/**' - paths: - - 'VERSION' permissions: contents: write @@ -96,99 +94,99 @@ jobs: retention-days: 1 if-no-files-found: error - build_linux: - name: "Build Linux" - runs-on: ubuntu-latest - - steps: - - name: Checkout code - uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 - - - name: Install dependencies - run: >- - sudo apt-get update - - - name: Set up Go - uses: WillAbides/setup-go-faster@a0ff5217a7d2567ed6ff1aa2b7d8f9d58173b2c9 # v1.14.0 - with: - go-version-file: 'go.mod' - - - name: Read version - run: | - echo "VERSION=$(cat VERSION)" >> $GITHUB_ENV - - - name: Build AMD64 - run: >- - env - GOARCH=amd64 - GOOS=linux - go build -a -v -trimpath -buildmode=pie -mod=readonly -modcacherw - -ldflags="-s -w -X main.version=${VERSION}" - -o bin/pinnacle-linux-amd64 - . - - - name: Build ARM64 - run: >- - env - GOARCH=arm64 - GOOS=linux - go build -a -v -trimpath -buildmode=pie -mod=readonly -modcacherw - -ldflags="-s -w -X main.version=${VERSION}" - -o bin/pinnacle-linux-arm64 - . - - - name: Upload artifact - uses: actions/upload-artifact@834a144ee995460fba8ed112a2fc961b36a5ec5a # v4.3.6 - with: - name: linux-binaries - path: bin - retention-days: 1 - if-no-files-found: error - - build_macos: - name: "Build MacOS" - runs-on: macos-latest - - steps: - - name: Checkout code - uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 - - - name: Set up Go - uses: WillAbides/setup-go-faster@a0ff5217a7d2567ed6ff1aa2b7d8f9d58173b2c9 # v1.14.0 - with: - go-version-file: 'go.mod' - - - name: Read version - run: | - echo "VERSION=$(cat VERSION)" >> $GITHUB_ENV - - - name: Build AMD64 - run: >- - env - GOARCH=amd64 - GOOS=darwin - go build -a -v -trimpath -buildmode=pie -mod=readonly -modcacherw - -ldflags="-s -w -X main.version=${VERSION}" - -o bin/pinnacle-darwin-amd64 - . - - - name: Build ARM64 - run: >- - env - GOARCH=arm64 - GOOS=darwin - go build -a -v -trimpath -buildmode=pie -mod=readonly -modcacherw - -ldflags="-s -w -X main.version=${VERSION}" - -o bin/pinnacle-darwin-arm64 - . - - - name: Upload artifact - uses: actions/upload-artifact@834a144ee995460fba8ed112a2fc961b36a5ec5a # v4.3.6 - with: - name: macos-binaries - path: bin - retention-days: 1 - if-no-files-found: error +# build_linux: +# name: "Build Linux" +# runs-on: ubuntu-latest +# +# steps: +# - name: Checkout code +# uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 +# +# - name: Install dependencies +# run: >- +# sudo apt-get update +# +# - name: Set up Go +# uses: WillAbides/setup-go-faster@a0ff5217a7d2567ed6ff1aa2b7d8f9d58173b2c9 # v1.14.0 +# with: +# go-version-file: 'go.mod' +# +# - name: Read version +# run: | +# echo "VERSION=$(cat VERSION)" >> $GITHUB_ENV +# +# - name: Build AMD64 +# run: >- +# env +# GOARCH=amd64 +# GOOS=linux +# go build -a -v -trimpath -buildmode=pie -mod=readonly -modcacherw +# -ldflags="-s -w -X main.version=${VERSION}" +# -o bin/pinnacle-linux-amd64 +# . +# +# - name: Build ARM64 +# run: >- +# env +# GOARCH=arm64 +# GOOS=linux +# go build -a -v -trimpath -buildmode=pie -mod=readonly -modcacherw +# -ldflags="-s -w -X main.version=${VERSION}" +# -o bin/pinnacle-linux-arm64 +# . +# +# - name: Upload artifact +# uses: actions/upload-artifact@834a144ee995460fba8ed112a2fc961b36a5ec5a # v4.3.6 +# with: +# name: linux-binaries +# path: bin +# retention-days: 1 +# if-no-files-found: error + +# build_macos: +# name: "Build MacOS" +# runs-on: macos-latest +# +# steps: +# - name: Checkout code +# uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 +# +# - name: Set up Go +# uses: WillAbides/setup-go-faster@a0ff5217a7d2567ed6ff1aa2b7d8f9d58173b2c9 # v1.14.0 +# with: +# go-version-file: 'go.mod' +# +# - name: Read version +# run: | +# echo "VERSION=$(cat VERSION)" >> $GITHUB_ENV +# +# - name: Build AMD64 +# run: >- +# env +# GOARCH=amd64 +# GOOS=darwin +# go build -a -v -trimpath -buildmode=pie -mod=readonly -modcacherw +# -ldflags="-s -w -X main.version=${VERSION}" +# -o bin/pinnacle-darwin-amd64 +# . +# +# - name: Build ARM64 +# run: >- +# env +# GOARCH=arm64 +# GOOS=darwin +# go build -a -v -trimpath -buildmode=pie -mod=readonly -modcacherw +# -ldflags="-s -w -X main.version=${VERSION}" +# -o bin/pinnacle-darwin-arm64 +# . +# +# - name: Upload artifact +# uses: actions/upload-artifact@834a144ee995460fba8ed112a2fc961b36a5ec5a # v4.3.6 +# with: +# name: macos-binaries +# path: bin +# retention-days: 1 +# if-no-files-found: error package_windows: name: "Package Windows" @@ -261,223 +259,223 @@ jobs: retention-days: 1 if-no-files-found: error - package_linux: - name: "Package Linux" - runs-on: ubuntu-latest - needs: [ build_linux ] - - steps: - - name: Checkout pkg files - uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 - with: - sparse-checkout: | - pkg/linux - VERSION - ci - - - name: Download binaries - uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 # v4.1.8 - with: - name: linux-binaries - path: bin - - - name: Install dependencies - run: >- - sudo apt-get update && - sudo apt-get install -y - rpm - debhelper - devscripts - dpkg-dev - libfuse2 - - - name: Read version - run: | - echo "VERSION=$(cat VERSION)" >> $GITHUB_ENV - - - name: Download AppImageTool - run: ./ci/download-appimagetool.sh - - - name: Prepare for packaging - run: | - # Edit version in spec/control files - sed -i "s/^Version:.*/Version: ${VERSION}/" pkg/linux/rpm/SPECS/pinnacle.spec - sed -i "s/^Release:.*/Release: ${RELEASE}/" pkg/linux/rpm/SPECS/pinnacle.spec - sed -i "s/^Version:.*/Version: ${VERSION}-${RELEASE}/" pkg/linux/deb/DEBIAN/control - - # Set up rpmbuild/debbuild/appimage file tree - mkdir -p ~/rpmbuild/{BUILD,RPMS,SOURCES,SPECS,SRPMS} - mkdir -p ~/debbuild/alpine-client/{DEBIAN,usr/bin,usr/share/applications,usr/share/pixmaps} - mkdir -p ~/appbuild/AlpineClient.AppDir/usr/{bin,share/{icons/hicolor/scalable/apps,licenses/alpine-client}} - - # Copy resources - cp -r pkg/linux/rpm/* ~/rpmbuild/ - cp -r pkg/linux/deb/* ~/debbuild/alpine-client/ - cp -r pkg/linux/appimage/* ~/appbuild/AlpineClient.AppDir/ - - # Copy binaries - cp bin/pinnacle-linux-amd64 ~/rpmbuild/SOURCES/ - cp bin/pinnacle-linux-amd64 ~/debbuild/alpine-client/usr/bin/alpine-client - cp bin/pinnacle-linux-amd64 ~/appbuild/AlpineClient.AppDir/usr/bin/alpine-client - - # Make binaries executable - chmod +x ~/rpmbuild/SOURCES/pinnacle-linux-amd64 - chmod +x ~/debbuild/alpine-client/usr/bin/alpine-client - chmod +x ~/appbuild/AlpineClient.AppDir/usr/bin/alpine-client - chmod +x ~/appbuild/AlpineClient.AppDir/AppRun - - # Create output folder - mkdir -p build/out - - - name: Package AMD64 RPM - run: >- - rpmbuild -bb - ~/rpmbuild/SPECS/pinnacle.spec - --define "_rpmdir build/out" - --target=x86_64 - - - name: Package AMD64 DEB - run: >- - dpkg-deb -Zgzip - --build ~/debbuild/alpine-client - "build/out/alpine-client_${VERSION}-${RELEASE}_amd64.deb" - - - name: Package AMD64 AppImage - run: >- - ./appimagetool-x86_64.AppImage ~/appbuild/AlpineClient.AppDir - "build/out/Alpine_Client-${VERSION}-x86_64.AppImage" - - - name: Swap AMD64 binary for ARM64 - run: | - # Remove amd64 binaries - rm -f ~/rpmbuild/SOURCES/pinnacle-darwin-amd64 - rm -f ~/debbuild/alpine-client/usr/bin/alpine-client - - # Edit arch & binary name in spec/control files - sed -i -e 's/linux-amd64/linux-arm64/g' -e 's/x86_64/aarch64/g' ~/rpmbuild/SPECS/pinnacle.spec - sed -i 's/amd64/arm64/g' ~/debbuild/alpine-client/DEBIAN/control - - # Copy arm64 binaries - cp bin/pinnacle-linux-arm64 ~/rpmbuild/SOURCES/ - cp bin/pinnacle-linux-arm64 ~/debbuild/alpine-client/usr/bin/alpine-client - - # Make binaries executable - chmod +x ~/rpmbuild/SOURCES/pinnacle-linux-arm64 - chmod +x ~/debbuild/alpine-client/usr/bin/alpine-client - - - name: Package ARM64 RPM - run: >- - rpmbuild -bb - ~/rpmbuild/SPECS/pinnacle.spec - --define "_rpmdir build/out" - --target=aarch64 - - - name: Package ARM64 DEB - run: >- - dpkg-deb -Zgzip - --build ~/debbuild/alpine-client - "build/out/alpine-client_${VERSION}-${RELEASE}_arm64.deb" - - - name: Tidy artifacts - run: | - if [ -d "build/out/x86_64" ]; then - cp -r build/out/x86_64/* build/out/ - fi - if [ -d "build/out/aarch64" ]; then - cp -r build/out/aarch64/* build/out/ - fi - rm -rf build/out/x86_64 - rm -rf build/out/aarch64 - - - name: Upload artifact - uses: actions/upload-artifact@834a144ee995460fba8ed112a2fc961b36a5ec5a # v4.3.6 - with: - name: linux-installers - path: build/out - retention-days: 1 - if-no-files-found: error - - package_macos: - name: "Package MacOS" - runs-on: macos-latest - needs: [ build_macos ] - - steps: - - name: Checkout pkg/darwin - uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 - with: - sparse-checkout: | - pkg/darwin - VERSION - - - name: Download binaries - uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 # v4.1.8 - with: - name: macos-binaries - path: bin - - - name: Read version - run: | - echo "VERSION=$(cat VERSION)" >> $GITHUB_ENV - - - name: Set up environment - run: | - # Set env variables for paths - APP="pkg/darwin/Alpine Client.app/Contents" - - # Create necessary folders - mkdir "${APP}/MacOS" - mkdir -p build/out/ - - # Replace version in Info.plist file - sed -i '' "s/1.0.0<\/string>/${VERSION}<\/string>/" "${APP}/Info.plist" - - # Move compiled binary - cp bin/pinnacle-darwin-amd64 "${APP}/MacOS/pinnacle-darwin-amd64" - - # Set permissions - chmod +x "${APP}/MacOS/pinnacle-darwin-amd64" - - # Export APP env for later - echo "APP=${APP}" >> $GITHUB_ENV - - - name: Package AMD64 - run: >- - pkgbuild - --root pkg/darwin - --identifier com.alpineclient.pinnacle - --version "${VERSION}" - --install-location /Applications - "build/out/AlpineClientSetup-${VERSION}-x86_64.pkg" - - - name: Swap AMD64 binary for ARM64 - run: | - rm -f "${APP}/MacOS/pinnacle-darwin-amd64" - cp bin/pinnacle-darwin-arm64 "${APP}/MacOS/pinnacle-darwin-arm64" - sed -i '' 's/amd64/arm64/g' "${APP}/Info.plist" - chmod +x "${APP}/MacOS/pinnacle-darwin-arm64" - - - name: Package ARM64 - run: >- - pkgbuild - --root pkg/darwin - --identifier com.alpineclient.pinnacle - --version "${VERSION}" - --install-location /Applications - "build/out/AlpineClientSetup-${VERSION}-ARM64.pkg" - - - name: Upload artifact - uses: actions/upload-artifact@834a144ee995460fba8ed112a2fc961b36a5ec5a # v4.3.6 - with: - name: macos-installers - path: build/out - retention-days: 1 - if-no-files-found: error +# package_linux: +# name: "Package Linux" +# runs-on: ubuntu-latest +# needs: [ build_linux ] +# +# steps: +# - name: Checkout pkg files +# uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 +# with: +# sparse-checkout: | +# pkg/linux +# VERSION +# ci +# +# - name: Download binaries +# uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 # v4.1.8 +# with: +# name: linux-binaries +# path: bin +# +# - name: Install dependencies +# run: >- +# sudo apt-get update && +# sudo apt-get install -y +# rpm +# debhelper +# devscripts +# dpkg-dev +# libfuse2 +# +# - name: Read version +# run: | +# echo "VERSION=$(cat VERSION)" >> $GITHUB_ENV +# +# - name: Download AppImageTool +# run: ./ci/download-appimagetool.sh +# +# - name: Prepare for packaging +# run: | +# # Edit version in spec/control files +# sed -i "s/^Version:.*/Version: ${VERSION}/" pkg/linux/rpm/SPECS/pinnacle.spec +# sed -i "s/^Release:.*/Release: ${RELEASE}/" pkg/linux/rpm/SPECS/pinnacle.spec +# sed -i "s/^Version:.*/Version: ${VERSION}-${RELEASE}/" pkg/linux/deb/DEBIAN/control +# +# # Set up rpmbuild/debbuild/appimage file tree +# mkdir -p ~/rpmbuild/{BUILD,RPMS,SOURCES,SPECS,SRPMS} +# mkdir -p ~/debbuild/alpine-client/{DEBIAN,usr/bin,usr/share/applications,usr/share/pixmaps} +# mkdir -p ~/appbuild/AlpineClient.AppDir/usr/{bin,share/{icons/hicolor/scalable/apps,licenses/alpine-client}} +# +# # Copy resources +# cp -r pkg/linux/rpm/* ~/rpmbuild/ +# cp -r pkg/linux/deb/* ~/debbuild/alpine-client/ +# cp -r pkg/linux/appimage/* ~/appbuild/AlpineClient.AppDir/ +# +# # Copy binaries +# cp bin/pinnacle-linux-amd64 ~/rpmbuild/SOURCES/ +# cp bin/pinnacle-linux-amd64 ~/debbuild/alpine-client/usr/bin/alpine-client +# cp bin/pinnacle-linux-amd64 ~/appbuild/AlpineClient.AppDir/usr/bin/alpine-client +# +# # Make binaries executable +# chmod +x ~/rpmbuild/SOURCES/pinnacle-linux-amd64 +# chmod +x ~/debbuild/alpine-client/usr/bin/alpine-client +# chmod +x ~/appbuild/AlpineClient.AppDir/usr/bin/alpine-client +# chmod +x ~/appbuild/AlpineClient.AppDir/AppRun +# +# # Create output folder +# mkdir -p build/out +# +# - name: Package AMD64 RPM +# run: >- +# rpmbuild -bb +# ~/rpmbuild/SPECS/pinnacle.spec +# --define "_rpmdir build/out" +# --target=x86_64 +# +# - name: Package AMD64 DEB +# run: >- +# dpkg-deb -Zgzip +# --build ~/debbuild/alpine-client +# "build/out/alpine-client_${VERSION}-${RELEASE}_amd64.deb" +# +# - name: Package AMD64 AppImage +# run: >- +# ./appimagetool-x86_64.AppImage ~/appbuild/AlpineClient.AppDir +# "build/out/Alpine_Client-${VERSION}-x86_64.AppImage" +# +# - name: Swap AMD64 binary for ARM64 +# run: | +# # Remove amd64 binaries +# rm -f ~/rpmbuild/SOURCES/pinnacle-darwin-amd64 +# rm -f ~/debbuild/alpine-client/usr/bin/alpine-client +# +# # Edit arch & binary name in spec/control files +# sed -i -e 's/linux-amd64/linux-arm64/g' -e 's/x86_64/aarch64/g' ~/rpmbuild/SPECS/pinnacle.spec +# sed -i 's/amd64/arm64/g' ~/debbuild/alpine-client/DEBIAN/control +# +# # Copy arm64 binaries +# cp bin/pinnacle-linux-arm64 ~/rpmbuild/SOURCES/ +# cp bin/pinnacle-linux-arm64 ~/debbuild/alpine-client/usr/bin/alpine-client +# +# # Make binaries executable +# chmod +x ~/rpmbuild/SOURCES/pinnacle-linux-arm64 +# chmod +x ~/debbuild/alpine-client/usr/bin/alpine-client +# +# - name: Package ARM64 RPM +# run: >- +# rpmbuild -bb +# ~/rpmbuild/SPECS/pinnacle.spec +# --define "_rpmdir build/out" +# --target=aarch64 +# +# - name: Package ARM64 DEB +# run: >- +# dpkg-deb -Zgzip +# --build ~/debbuild/alpine-client +# "build/out/alpine-client_${VERSION}-${RELEASE}_arm64.deb" +# +# - name: Tidy artifacts +# run: | +# if [ -d "build/out/x86_64" ]; then +# cp -r build/out/x86_64/* build/out/ +# fi +# if [ -d "build/out/aarch64" ]; then +# cp -r build/out/aarch64/* build/out/ +# fi +# rm -rf build/out/x86_64 +# rm -rf build/out/aarch64 +# +# - name: Upload artifact +# uses: actions/upload-artifact@834a144ee995460fba8ed112a2fc961b36a5ec5a # v4.3.6 +# with: +# name: linux-installers +# path: build/out +# retention-days: 1 +# if-no-files-found: error +# +# package_macos: +# name: "Package MacOS" +# runs-on: macos-latest +# needs: [ build_macos ] +# +# steps: +# - name: Checkout pkg/darwin +# uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 +# with: +# sparse-checkout: | +# pkg/darwin +# VERSION +# +# - name: Download binaries +# uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 # v4.1.8 +# with: +# name: macos-binaries +# path: bin +# +# - name: Read version +# run: | +# echo "VERSION=$(cat VERSION)" >> $GITHUB_ENV +# +# - name: Set up environment +# run: | +# # Set env variables for paths +# APP="pkg/darwin/Alpine Client.app/Contents" +# +# # Create necessary folders +# mkdir "${APP}/MacOS" +# mkdir -p build/out/ +# +# # Replace version in Info.plist file +# sed -i '' "s/1.0.0<\/string>/${VERSION}<\/string>/" "${APP}/Info.plist" +# +# # Move compiled binary +# cp bin/pinnacle-darwin-amd64 "${APP}/MacOS/pinnacle-darwin-amd64" +# +# # Set permissions +# chmod +x "${APP}/MacOS/pinnacle-darwin-amd64" +# +# # Export APP env for later +# echo "APP=${APP}" >> $GITHUB_ENV +# +# - name: Package AMD64 +# run: >- +# pkgbuild +# --root pkg/darwin +# --identifier com.alpineclient.pinnacle +# --version "${VERSION}" +# --install-location /Applications +# "build/out/AlpineClientSetup-${VERSION}-x86_64.pkg" +# +# - name: Swap AMD64 binary for ARM64 +# run: | +# rm -f "${APP}/MacOS/pinnacle-darwin-amd64" +# cp bin/pinnacle-darwin-arm64 "${APP}/MacOS/pinnacle-darwin-arm64" +# sed -i '' 's/amd64/arm64/g' "${APP}/Info.plist" +# chmod +x "${APP}/MacOS/pinnacle-darwin-arm64" +# +# - name: Package ARM64 +# run: >- +# pkgbuild +# --root pkg/darwin +# --identifier com.alpineclient.pinnacle +# --version "${VERSION}" +# --install-location /Applications +# "build/out/AlpineClientSetup-${VERSION}-ARM64.pkg" +# +# - name: Upload artifact +# uses: actions/upload-artifact@834a144ee995460fba8ed112a2fc961b36a5ec5a # v4.3.6 +# with: +# name: macos-installers +# path: build/out +# retention-days: 1 +# if-no-files-found: error create_github_release: name: "Create GitHub Release" runs-on: ubuntu-latest - needs: [ package_windows, package_linux, package_macos ] + needs: [ package_windows ] steps: - name: Checkout version file @@ -501,13 +499,13 @@ jobs: # Combine binaries cp -r all/windows-binaries/* merged/binaries/ - cp -r all/linux-binaries/* merged/binaries/ - cp -r all/macos-binaries/* merged/binaries/ + # cp -r all/linux-binaries/* merged/binaries/ + # cp -r all/macos-binaries/* merged/binaries/ # Combine installers cp -r all/windows-installers/* merged/installers/ - cp -r all/macos-installers/* merged/installers/ - cp -r all/linux-installers/* merged/installers/ + # cp -r all/macos-installers/* merged/installers/ + # cp -r all/linux-installers/* merged/installers/ - name: Upload artifact uses: actions/upload-artifact@834a144ee995460fba8ed112a2fc961b36a5ec5a # v4.3.6 diff --git a/pkg/windows/iss/PackagePinnacle-amd64.iss b/pkg/windows/iss/PackagePinnacle-amd64.iss index 978b4d7..b63bf75 100644 --- a/pkg/windows/iss/PackagePinnacle-amd64.iss +++ b/pkg/windows/iss/PackagePinnacle-amd64.iss @@ -31,6 +31,7 @@ MinVersion=6.1 ArchitecturesAllowed=x64 ArchitecturesInstallIn64BitMode=x64 UninstallDisplayIcon={uninstallexe} +PrivilegesRequired=lowest [Languages] Name: "english"; MessagesFile: "compiler:Default.isl" diff --git a/pkg/windows/iss/PackagePinnacle-arm64.iss b/pkg/windows/iss/PackagePinnacle-arm64.iss index 5564e18..a05bcc9 100644 --- a/pkg/windows/iss/PackagePinnacle-arm64.iss +++ b/pkg/windows/iss/PackagePinnacle-arm64.iss @@ -31,6 +31,7 @@ MinVersion=6.2 ArchitecturesAllowed=arm64 ArchitecturesInstallIn64BitMode=arm64 UninstallDisplayIcon={uninstallexe} +PrivilegesRequired=lowest [Languages] Name: "english"; MessagesFile: "compiler:Default.isl"