From a76d18c668291ef9ed27334ce1a6212ed9264629 Mon Sep 17 00:00:00 2001 From: Aikawa Yataro Date: Fri, 2 Aug 2024 13:03:50 +0000 Subject: [PATCH 01/12] ci: refactor jobs into a single job with matrix --- .github/workflows/ci.yml | 137 ++++++++++----------------------------- 1 file changed, 33 insertions(+), 104 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 0e462a55..9b1cd88e 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -1,107 +1,32 @@ name: Continuous Integration on: push: - branches: - - develop + branches: [develop] pull_request: branches: [develop] workflow_dispatch: jobs: - build-windows: - name: Build Windows x64 - runs-on: windows-2019 - steps: - - name: Checkout sources - uses: actions/checkout@v4 - with: - fetch-depth: 0 - - name: Setup .NET - uses: actions/setup-dotnet@v4 - with: - dotnet-version: 8.0.x - - name: Build - run: dotnet build -c Release - - name: Publish - run: dotnet publish src/SourceGit.csproj -c Release -o publish -r win-x64 - - name: Upload Artifact - uses: actions/upload-artifact@v4 - with: - name: sourcegit.win-x64 - path: publish - build-macos-intel: - name: Build macOS (Intel) - runs-on: macos-13 - steps: - - name: Checkout sources - uses: actions/checkout@v4 - with: - fetch-depth: 0 - - name: Setup .NET - uses: actions/setup-dotnet@v4 - with: - dotnet-version: 8.0.x - - name: Build - run: dotnet build -c Release - - name: Publish - run: dotnet publish src/SourceGit.csproj -c Release -o publish -r osx-x64 - - name: Packing Program - run: tar -cvf sourcegit.osx-x64.tar -C publish/ . - - name: Upload Artifact - uses: actions/upload-artifact@v4 - with: - name: sourcegit.osx-x64 - path: sourcegit.osx-x64.tar - build-macos-arm64: - name: Build macOS (Apple Silicon) - runs-on: macos-latest - steps: - - name: Checkout sources - uses: actions/checkout@v4 - with: - fetch-depth: 0 - - name: Setup .NET - uses: actions/setup-dotnet@v4 - with: - dotnet-version: 8.0.x - - name: Build - run: dotnet build -c Release - - name: Publish - run: dotnet publish src/SourceGit.csproj -c Release -o publish -r osx-arm64 - - name: Packing Program - run: tar -cvf sourcegit.osx-arm64.tar -C publish/ . - - name: Upload Artifact - uses: actions/upload-artifact@v4 - with: - name: sourcegit.osx-arm64 - path: sourcegit.osx-arm64.tar - build-linux: - name: Build Linux - runs-on: ubuntu-20.04 - steps: - - name: Checkout sources - uses: actions/checkout@v4 - with: - fetch-depth: 0 - - name: Setup .NET - uses: actions/setup-dotnet@v4 - with: - dotnet-version: 8.0.x - - name: Build - run: dotnet build -c Release - - name: Publish - run: dotnet publish src/SourceGit.csproj -c Release -o publish -r linux-x64 - - name: Rename Executable File - run: mv publish/SourceGit publish/sourcegit - - name: Packing Program - run: tar -cvf sourcegit.linux-x64.tar -C publish/ . - - name: Upload Artifact - uses: actions/upload-artifact@v4 - with: - name: sourcegit.linux-x64 - path: sourcegit.linux-x64.tar - build-linux-arm64: - name: Build Linux (arm64) - runs-on: ubuntu-20.04 + build: + strategy: + matrix: + include: + - name : Windows x64 + os: windows-2019 + runtime: win-x64 + - name : macOS (Intel) + os: macos-13 + runtime: osx-x64 + - name : macOS (Apple Silicon) + os: macos-latest + runtime: osx-arm64 + - name : Linux + os: ubuntu-20.04 + runtime: linux-x64 + - name : Linux (arm64) + os: ubuntu-20.04 + runtime: linux-arm64 + name: Build ${{ matrix.name }} + runs-on: ${{ matrix.os }} steps: - name: Checkout sources uses: actions/checkout@v4 @@ -112,6 +37,7 @@ jobs: with: dotnet-version: 8.0.x - name: Configure arm64 packages + if: ${{ matrix.runtime == 'linux-arm64' }} run: | sudo dpkg --add-architecture arm64 echo 'deb [arch=arm64] http://ports.ubuntu.com/ubuntu-ports/ focal main restricted @@ -121,19 +47,22 @@ jobs: sudo sed -i -e 's/^deb http/deb [arch=amd64] http/g' /etc/apt/sources.list sudo sed -i -e 's/^deb mirror/deb [arch=amd64] mirror/g' /etc/apt/sources.list - name: Install cross-compiling dependencies + if: ${{ matrix.runtime == 'linux-arm64' }} run: | sudo apt-get update sudo apt-get install clang llvm gcc-aarch64-linux-gnu zlib1g-dev:arm64 - name: Build run: dotnet build -c Release - name: Publish - run: dotnet publish src/SourceGit.csproj -c Release -o publish -r linux-arm64 - - name: Rename Executable File + run: dotnet publish src/SourceGit.csproj -c Release -o publish -r ${{ matrix.runtime }} + - name: Rename executable file + if: ${{ startsWith(matrix.runtime, 'linux-') }} run: mv publish/SourceGit publish/sourcegit - - name: Packing Program - run: tar -cvf sourcegit.linux-arm64.tar -C publish/ . - - name: Upload Artifact + - name: Package program + if: ${{ ! startsWith(matrix.runtime, 'win-') }} + run: tar -cvf sourcegit.${{ matrix.runtime }}.tar -C publish/ . + - name: Upload artifact uses: actions/upload-artifact@v4 with: - name: sourcegit.linux-arm64 - path: sourcegit.linux-arm64.tar + name: sourcegit.${{ matrix.runtime }} + path: ${{ startsWith(matrix.runtime, 'win-') && 'publish' || format('sourcegit.{0}.tar', matrix.runtime) }} From 0492f8e75e15e3ad7a0961f789fe1209fa71624f Mon Sep 17 00:00:00 2001 From: Aikawa Yataro Date: Fri, 2 Aug 2024 14:25:25 +0000 Subject: [PATCH 02/12] ci: add win-arm64 job --- .github/workflows/ci.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 9b1cd88e..84b7558a 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -13,6 +13,9 @@ jobs: - name : Windows x64 os: windows-2019 runtime: win-x64 + - name : Windows ARM64 + os: windows-2019 + runtime: win-arm64 - name : macOS (Intel) os: macos-13 runtime: osx-x64 From 08aa96f1c5d8c42a5ae7de1df05f8201cf1b9d64 Mon Sep 17 00:00:00 2001 From: Aikawa Yataro Date: Fri, 2 Aug 2024 15:06:42 +0000 Subject: [PATCH 03/12] ci: don't tar the artifacts since GitHub will archive it anyway --- .github/workflows/ci.yml | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 84b7558a..253df156 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -61,11 +61,8 @@ jobs: - name: Rename executable file if: ${{ startsWith(matrix.runtime, 'linux-') }} run: mv publish/SourceGit publish/sourcegit - - name: Package program - if: ${{ ! startsWith(matrix.runtime, 'win-') }} - run: tar -cvf sourcegit.${{ matrix.runtime }}.tar -C publish/ . - name: Upload artifact uses: actions/upload-artifact@v4 with: name: sourcegit.${{ matrix.runtime }} - path: ${{ startsWith(matrix.runtime, 'win-') && 'publish' || format('sourcegit.{0}.tar', matrix.runtime) }} + path: publish From 646f7f90cfdaa2ec625c919a7598730a8da42125 Mon Sep 17 00:00:00 2001 From: Aikawa Yataro Date: Fri, 2 Aug 2024 19:22:38 +0000 Subject: [PATCH 04/12] ci: allow build to be triggered by call --- .github/workflows/ci.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 253df156..3a12b9e1 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -5,6 +5,7 @@ on: pull_request: branches: [develop] workflow_dispatch: + workflow_call: jobs: build: strategy: @@ -33,8 +34,6 @@ jobs: steps: - name: Checkout sources uses: actions/checkout@v4 - with: - fetch-depth: 0 - name: Setup .NET uses: actions/setup-dotnet@v4 with: From 6bea4b42a2a1951266ce416ede0be50b64aba8b8 Mon Sep 17 00:00:00 2001 From: Aikawa Yataro Date: Fri, 2 Aug 2024 20:49:08 +0000 Subject: [PATCH 05/12] build: refactor build scripts use right way to include symlinks and some other minor changes --- build/build.linux.sh | 3 ++- build/resources/deb/DEBIAN/control | 2 +- build/resources/deb/DEBIAN/postinst | 5 ----- build/resources/deb/DEBIAN/postrm | 4 ---- build/resources/rpm/SPECS/build.spec | 33 ++++++++++++++-------------- 5 files changed, 19 insertions(+), 28 deletions(-) delete mode 100755 build/resources/deb/DEBIAN/postinst delete mode 100755 build/resources/deb/DEBIAN/postrm diff --git a/build/build.linux.sh b/build/build.linux.sh index 55bc2f62..21280527 100755 --- a/build/build.linux.sh +++ b/build/build.linux.sh @@ -16,12 +16,13 @@ cd ../../ # Debain/Ubuntu package mkdir -p resources/deb/opt/sourcegit/ +mkdir -p resources/deb/usr/bin mkdir -p resources/deb/usr/share/applications mkdir -p resources/deb/usr/share/icons cp -f SourceGit/* resources/deb/opt/sourcegit/ +ln -sf ../../opt/sourcegit/sourcegit resources/deb/usr/bin cp -r resources/_common/applications resources/deb/usr/share/ cp -r resources/_common/icons resources/deb/usr/share/ -chmod +x -R resources/deb/opt/sourcegit sed -i "2s/.*/Version: ${version}/g" resources/deb/DEBIAN/control dpkg-deb --build resources/deb ./sourcegit_${version}-1_amd64.deb diff --git a/build/resources/deb/DEBIAN/control b/build/resources/deb/DEBIAN/control index 44dbf397..7cfed330 100755 --- a/build/resources/deb/DEBIAN/control +++ b/build/resources/deb/DEBIAN/control @@ -1,5 +1,5 @@ Package: sourcegit -Version: 8.18 +Version: 8.23 Priority: optional Depends: libx11-6, libice6, libsm6 Architecture: amd64 diff --git a/build/resources/deb/DEBIAN/postinst b/build/resources/deb/DEBIAN/postinst deleted file mode 100755 index 56aba83b..00000000 --- a/build/resources/deb/DEBIAN/postinst +++ /dev/null @@ -1,5 +0,0 @@ -#!bin/sh - -echo 'Create link on /usr/bin' -ln -s /opt/sourcegit/sourcegit /usr/bin/sourcegit -exit 0 \ No newline at end of file diff --git a/build/resources/deb/DEBIAN/postrm b/build/resources/deb/DEBIAN/postrm deleted file mode 100755 index 5a600118..00000000 --- a/build/resources/deb/DEBIAN/postrm +++ /dev/null @@ -1,4 +0,0 @@ -#!bin/sh - -rm -f /usr/bin/sourcegit -exit 0 \ No newline at end of file diff --git a/build/resources/rpm/SPECS/build.spec b/build/resources/rpm/SPECS/build.spec index ddafcfb8..86a7cfdd 100644 --- a/build/resources/rpm/SPECS/build.spec +++ b/build/resources/rpm/SPECS/build.spec @@ -14,24 +14,23 @@ Requires: libSM.so.6 Open-source & Free Git Gui Client %install -mkdir -p $RPM_BUILD_ROOT/opt/sourcegit -mkdir -p $RPM_BUILD_ROOT/usr/share/applications -mkdir -p $RPM_BUILD_ROOT/usr/share/icons -cp -r ../../_common/applications $RPM_BUILD_ROOT/usr/share/ -cp -r ../../_common/icons $RPM_BUILD_ROOT/usr/share/ -cp -f ../../../SourceGit/* $RPM_BUILD_ROOT/opt/sourcegit/ -chmod 755 -R $RPM_BUILD_ROOT/opt/sourcegit -chmod 755 $RPM_BUILD_ROOT/usr/share/applications/sourcegit.desktop +mkdir -p %{buildroot}/opt/sourcegit +mkdir -p %{buildroot}/%{_bindir} +mkdir -p %{buildroot}/usr/share/applications +mkdir -p %{buildroot}/usr/share/icons +cp -f ../../../SourceGit/* %{buildroot}/opt/sourcegit/ +ln -sf ../../opt/sourcegit/sourcegit %{buildroot}/%{_bindir} +cp -r ../../_common/applications %{buildroot}/%{_datadir} +cp -r ../../_common/icons %{buildroot}/%{_datadir} +chmod 755 -R %{buildroot}/opt/sourcegit +chmod 755 %{buildroot}/%{_datadir}/applications/sourcegit.desktop %files -/opt/sourcegit -/usr/share - -%post -ln -s /opt/sourcegit/sourcegit /usr/bin/sourcegit - -%postun -rm -f /usr/bin/sourcegit +%dir /opt/sourcegit/ +/opt/sourcegit/* +/usr/share/applications/sourcegit.desktop +/usr/share/icons/* +%{_bindir}/sourcegit %changelog -# skip \ No newline at end of file +# skip From 97d622a8b711861c5b7b07b6e0828f00e5b3b3a6 Mon Sep 17 00:00:00 2001 From: Aikawa Yataro Date: Sat, 3 Aug 2024 05:55:36 +0000 Subject: [PATCH 06/12] build: fix some AppStream metadata warnings --- build/resources/appimage/sourcegit.appdata.xml | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/build/resources/appimage/sourcegit.appdata.xml b/build/resources/appimage/sourcegit.appdata.xml index ca304b4b..012c82d3 100644 --- a/build/resources/appimage/sourcegit.appdata.xml +++ b/build/resources/appimage/sourcegit.appdata.xml @@ -1,6 +1,6 @@ - com.sourcegit-scm.SourceGit + com.sourcegit_scm.SourceGit MIT MIT SourceGit @@ -8,8 +8,9 @@

Open-source GUI client for git users

- com.sourcegit-scm.SourceGit.desktop + https://github.com/sourcegit-scm/sourcegit + com.sourcegit_scm.SourceGit.desktop - com.sourcegit-scm.SourceGit.desktop + com.sourcegit_scm.SourceGit.desktop -
\ No newline at end of file + From 455ad657a7fbb0285bc9fd19689b90b4ecb26a3a Mon Sep 17 00:00:00 2001 From: Aikawa Yataro Date: Sat, 3 Aug 2024 06:43:17 +0000 Subject: [PATCH 07/12] build: force root owner for deb package --- build/build.linux.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build/build.linux.sh b/build/build.linux.sh index 21280527..585dcfb3 100755 --- a/build/build.linux.sh +++ b/build/build.linux.sh @@ -24,7 +24,7 @@ ln -sf ../../opt/sourcegit/sourcegit resources/deb/usr/bin cp -r resources/_common/applications resources/deb/usr/share/ cp -r resources/_common/icons resources/deb/usr/share/ sed -i "2s/.*/Version: ${version}/g" resources/deb/DEBIAN/control -dpkg-deb --build resources/deb ./sourcegit_${version}-1_amd64.deb +dpkg-deb --root-owner-group --build resources/deb ./sourcegit_${version}-1_amd64.deb # Redhat/CentOS/Fedora package rpmbuild -bb --target=x86_64 resources/rpm/SPECS/build.spec --define "_topdir `pwd`/resources/rpm" --define "_version ${version}" From 073b5aaf9e0833acdbe6df34191a0213baca00a3 Mon Sep 17 00:00:00 2001 From: Aikawa Yataro Date: Sat, 3 Aug 2024 10:01:02 +0000 Subject: [PATCH 08/12] ci: add automatic releases --- .github/workflows/package.yml | 95 ++++++++++++++++++++++++++++ .github/workflows/release.yml | 49 ++++++++++++++ build/ci/package.linux.sh | 78 +++++++++++++++++++++++ build/ci/package.osx-app.sh | 22 +++++++ build/ci/package.windows-portable.sh | 19 ++++++ 5 files changed, 263 insertions(+) create mode 100644 .github/workflows/package.yml create mode 100644 .github/workflows/release.yml create mode 100755 build/ci/package.linux.sh create mode 100755 build/ci/package.osx-app.sh create mode 100755 build/ci/package.windows-portable.sh diff --git a/.github/workflows/package.yml b/.github/workflows/package.yml new file mode 100644 index 00000000..8ffcf88e --- /dev/null +++ b/.github/workflows/package.yml @@ -0,0 +1,95 @@ +name: Package +on: + workflow_call: + inputs: + version: + description: Source Git package version + required: true + type: string +jobs: + build: + name: Build + uses: ./.github/workflows/ci.yml + windows-portable: + name: Package portable Windows app + needs: build + runs-on: ubuntu-latest + strategy: + matrix: + runtime: [win-x64, win-arm64] + steps: + - name: Checkout sources + uses: actions/checkout@v4 + - name: Download build + uses: actions/download-artifact@v4 + with: + name: sourcegit.${{ matrix.runtime }} + path: build/SourceGit + - name: Package + env: + VERSION: ${{ inputs.version }} + RUNTIME: ${{ matrix.runtime }} + run: ./build/ci/package.windows-portable.sh + - name: Upload package artifact + uses: actions/upload-artifact@v4 + with: + name: package.${{ matrix.runtime }} + path: build/sourcegit_*.zip + osx-app: + name: Package OSX app + needs: build + runs-on: ubuntu-latest + strategy: + matrix: + runtime: [osx-x64, osx-arm64] + steps: + - name: Checkout sources + uses: actions/checkout@v4 + - name: Download build + uses: actions/download-artifact@v4 + with: + name: sourcegit.${{ matrix.runtime }} + path: build/SourceGit + - name: Package + env: + VERSION: ${{ inputs.version }} + RUNTIME: ${{ matrix.runtime }} + run: ./build/ci/package.osx-app.sh + - name: Upload package artifact + uses: actions/upload-artifact@v4 + with: + name: package.${{ matrix.runtime }} + path: build/sourcegit_*.zip + linux: + name: Package Linux + needs: build + runs-on: ubuntu-latest + strategy: + matrix: + runtime: [linux-x64, linux-arm64] + steps: + - name: Checkout sources + uses: actions/checkout@v4 + - name: Download package dependencies + run: | + sudo add-apt-repository universe + sudo apt-get update + sudo apt-get install desktop-file-utils rpm libfuse2 + - name: Download build + uses: actions/download-artifact@v4 + with: + name: sourcegit.${{ matrix.runtime }} + path: build/SourceGit + - name: Package + env: + VERSION: ${{ inputs.version }} + RUNTIME: ${{ matrix.runtime }} + run: ./build/ci/package.linux.sh + - name: Upload package artifacts + uses: actions/upload-artifact@v4 + with: + name: package.${{ matrix.runtime }} + path: | + build/sourcegit-*.AppImage + build/sourcegit_*.deb + build/sourcegit-*.rpm diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 00000000..51e247d2 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,49 @@ +name: Release +on: + push: + tags: + - v* +jobs: + version: + name: Prepare version string + runs-on: ubuntu-latest + outputs: + version: ${{ steps.version.outputs.version }} + steps: + - name: Output version string + id: version + env: + TAG: ${{ github.ref_name }} + run: echo "version=${TAG#v}" >> "$GITHUB_OUTPUT" + package: + needs: version + name: Package + uses: ./.github/workflows/package.yml + with: + version: ${{ needs.version.outputs.version }} + release: + needs: [version, package] + name: Release + runs-on: ubuntu-latest + permissions: + contents: write + steps: + - name: Checkout sources + uses: actions/checkout@v4 + - name: Create release + env: + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} + TAG: ${{ github.ref_name }} + run: gh release create "$TAG" -t "Release ${TAG#v}" --notes-from-tag + - name: Download artifacts + uses: actions/download-artifact@v4 + with: + pattern: package.* + path: packages + merge-multiple: true + - name: Upload assets + env: + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} + TAG: ${{ github.ref_name }} + VERSION: ${{ needs.version.outputs.version }} + run: gh release upload "$TAG" packages/* diff --git a/build/ci/package.linux.sh b/build/ci/package.linux.sh new file mode 100755 index 00000000..c4c23d14 --- /dev/null +++ b/build/ci/package.linux.sh @@ -0,0 +1,78 @@ +#!/bin/bash + +set -e + +if [ -z "$VERSION" ]; then + echo "Provide the version as environment variable VERSION" + exit 1 +fi + +if [ -z "$RUNTIME" ]; then + echo "Provide the runtime as environment variable RUNTIME" + exit 1 +fi + +arch= +appimage_arch= +appimage_runtime= +target= +case "$RUNTIME" in + linux-x64) + arch=amd64 + appimage_arch=x86_64 + appimage_runtime=runtime-fuse2-x86_64 + target=x86_64;; + linux-arm64) + arch=arm64 + appimage_arch=arm_aarch64 + appimage_runtime=runtime-fuse2-aarch64 + target=aarch64;; + *) + echo "Unknown runtime $RUNTIME" + exit 1;; +esac + +APPIMAGETOOL_URL=https://github.com/AppImage/appimagetool/releases/download/continuous/appimagetool-x86_64.AppImage +APPIMAGE_RUNTIME_URL=https://github.com/AppImage/type2-runtime/releases/download/old/$appimage_runtime + +cd build + +if [ ! -f "appimagetool" ]; then + curl -o appimagetool -L "$APPIMAGETOOL_URL" + chmod +x appimagetool +fi + +if [ ! -f "appimage_runtime" ]; then + curl -o appimage_runtime -L "$APPIMAGE_RUNTIME_URL" +fi + +rm -f SourceGit/*.dbg + +mkdir -p SourceGit.AppDir/opt +mkdir -p SourceGit.AppDir/usr/share/metainfo +mkdir -p SourceGit.AppDir/usr/share/applications + +cp -r SourceGit SourceGit.AppDir/opt/sourcegit +desktop-file-install resources/_common/applications/sourcegit.desktop --dir SourceGit.AppDir/usr/share/applications \ + --set-icon com.sourcegit_scm.SourceGit --set-key=Exec --set-value=AppRun +mv SourceGit.AppDir/usr/share/applications/{sourcegit,com.sourcegit_scm.SourceGit}.desktop +cp resources/appimage/sourcegit.png SourceGit.AppDir/com.sourcegit_scm.SourceGit.png +ln -sf /opt/sourcegit/sourcegit SourceGit.AppDir/AppRun +ln -rsf SourceGit.AppDir/usr/share/applications/com.sourcegit_scm.SourceGit.desktop SourceGit.AppDir +cp resources/appimage/sourcegit.appdata.xml SourceGit.AppDir/usr/share/metainfo/com.sourcegit_scm.SourceGit.appdata.xml + +ARCH="$appimage_arch" ./appimagetool -v --runtime-file appimage_runtime SourceGit.AppDir "sourcegit-$VERSION.linux.$arch.AppImage" + +mkdir -p resources/deb/opt/sourcegit/ +mkdir -p resources/deb/usr/bin +mkdir -p resources/deb/usr/share/applications +mkdir -p resources/deb/usr/share/icons +cp -f SourceGit/* resources/deb/opt/sourcegit +ln -sf ../../opt/sourcegit/sourcegit resources/deb/usr/bin +cp -r resources/_common/applications resources/deb/usr/share +cp -r resources/_common/icons resources/deb/usr/share +sed -i -e "s/^Version:.*/Version: $VERSION/" -e "s/^Architecture:.*/Architecture: $arch/" resources/deb/DEBIAN/control +dpkg-deb --root-owner-group --build resources/deb "sourcegit_$VERSION-1_$arch.deb" + +rpmbuild -bb --target="$target" resources/rpm/SPECS/build.spec --define "_topdir $(pwd)/resources/rpm" --define "_version $VERSION" +mv "resources/rpm/RPMS/$target/sourcegit-$VERSION-1.$target.rpm" ./ diff --git a/build/ci/package.osx-app.sh b/build/ci/package.osx-app.sh new file mode 100755 index 00000000..80e66a08 --- /dev/null +++ b/build/ci/package.osx-app.sh @@ -0,0 +1,22 @@ +#!/bin/bash + +set -e + +if [ -z "$VERSION" ]; then + echo "Provide the version as environment variable VERSION" + exit 1 +fi + +if [ -z "$RUNTIME" ]; then + echo "Provide the runtime as environment variable RUNTIME" + exit 1 +fi + +cd build + +mkdir -p SourceGit.app/Contents/Resources +mv SourceGit SourceGit.app/Contents/MacOS +cp resources/app/App.icns SourceGit.app/Contents/Resources/App.icns +sed "s/SOURCE_GIT_VERSION/$VERSION/g" resources/app/App.plist > SourceGit.app/Contents/Info.plist + +zip "sourcegit_$VERSION.$RUNTIME.zip" -r SourceGit.app -x "*/*\.dsym/*" diff --git a/build/ci/package.windows-portable.sh b/build/ci/package.windows-portable.sh new file mode 100755 index 00000000..cc5ee1bd --- /dev/null +++ b/build/ci/package.windows-portable.sh @@ -0,0 +1,19 @@ +#!/bin/bash + +set -e + +if [ -z "$VERSION" ]; then + echo "Provide the version as environment variable VERSION" + exit 1 +fi + +if [ -z "$RUNTIME" ]; then + echo "Provide the runtime as environment variable RUNTIME" + exit 1 +fi + +cd build + +rm -rf SourceGit/*.pdb + +zip "sourcegit_$VERSION.$RUNTIME.zip" -r SourceGit From 822d6ec88e0774e23fae8e7ca31c07b35c450057 Mon Sep 17 00:00:00 2001 From: Aikawa Yataro Date: Sat, 3 Aug 2024 13:50:57 +0000 Subject: [PATCH 09/12] ci: tar artifact to keep permissions --- .github/workflows/ci.yml | 6 ++++++ .github/workflows/package.yml | 7 +++++-- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 3a12b9e1..87d460c6 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -60,6 +60,12 @@ jobs: - name: Rename executable file if: ${{ startsWith(matrix.runtime, 'linux-') }} run: mv publish/SourceGit publish/sourcegit + - name: Tar artifact + if: ${{ startsWith(matrix.runtime, 'linux-') }} + run: | + tar -cvf "sourcegit.${{ matrix.runtime }}.tar" -C publish . + rm -r publish/* + mv "sourcegit.${{ matrix.runtime }}.tar" publish - name: Upload artifact uses: actions/upload-artifact@v4 with: diff --git a/.github/workflows/package.yml b/.github/workflows/package.yml index 8ffcf88e..404c909e 100644 --- a/.github/workflows/package.yml +++ b/.github/workflows/package.yml @@ -79,12 +79,15 @@ jobs: uses: actions/download-artifact@v4 with: name: sourcegit.${{ matrix.runtime }} - path: build/SourceGit + path: build - name: Package env: VERSION: ${{ inputs.version }} RUNTIME: ${{ matrix.runtime }} - run: ./build/ci/package.linux.sh + run: | + mkdir build/SourceGit + tar -xf "build/sourcegit.${{ matrix.runtime }}.tar" -C build/SourceGit + ./build/ci/package.linux.sh - name: Upload package artifacts uses: actions/upload-artifact@v4 with: From 00a11fbd02566bc0cc74e7c59b512058ebbff5e4 Mon Sep 17 00:00:00 2001 From: Aikawa Yataro Date: Wed, 7 Aug 2024 03:26:57 +0000 Subject: [PATCH 10/12] ci: use relative link for AppImage's AppRun --- build/ci/package.linux.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build/ci/package.linux.sh b/build/ci/package.linux.sh index c4c23d14..b9a86551 100755 --- a/build/ci/package.linux.sh +++ b/build/ci/package.linux.sh @@ -57,7 +57,7 @@ desktop-file-install resources/_common/applications/sourcegit.desktop --dir Sour --set-icon com.sourcegit_scm.SourceGit --set-key=Exec --set-value=AppRun mv SourceGit.AppDir/usr/share/applications/{sourcegit,com.sourcegit_scm.SourceGit}.desktop cp resources/appimage/sourcegit.png SourceGit.AppDir/com.sourcegit_scm.SourceGit.png -ln -sf /opt/sourcegit/sourcegit SourceGit.AppDir/AppRun +ln -rsf SourceGit.AppDir/opt/sourcegit/sourcegit SourceGit.AppDir/AppRun ln -rsf SourceGit.AppDir/usr/share/applications/com.sourcegit_scm.SourceGit.desktop SourceGit.AppDir cp resources/appimage/sourcegit.appdata.xml SourceGit.AppDir/usr/share/metainfo/com.sourcegit_scm.SourceGit.appdata.xml From 05ddd42604c893ab4cf1396f18c69adaf1155933 Mon Sep 17 00:00:00 2001 From: Aikawa Yataro Date: Sun, 11 Aug 2024 15:43:36 +0000 Subject: [PATCH 11/12] ci: use new AppImage runtime --- build/ci/package.linux.sh | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) diff --git a/build/ci/package.linux.sh b/build/ci/package.linux.sh index b9a86551..04309018 100755 --- a/build/ci/package.linux.sh +++ b/build/ci/package.linux.sh @@ -14,18 +14,15 @@ fi arch= appimage_arch= -appimage_runtime= target= case "$RUNTIME" in linux-x64) arch=amd64 appimage_arch=x86_64 - appimage_runtime=runtime-fuse2-x86_64 target=x86_64;; linux-arm64) arch=arm64 appimage_arch=arm_aarch64 - appimage_runtime=runtime-fuse2-aarch64 target=aarch64;; *) echo "Unknown runtime $RUNTIME" @@ -33,7 +30,6 @@ case "$RUNTIME" in esac APPIMAGETOOL_URL=https://github.com/AppImage/appimagetool/releases/download/continuous/appimagetool-x86_64.AppImage -APPIMAGE_RUNTIME_URL=https://github.com/AppImage/type2-runtime/releases/download/old/$appimage_runtime cd build @@ -42,10 +38,6 @@ if [ ! -f "appimagetool" ]; then chmod +x appimagetool fi -if [ ! -f "appimage_runtime" ]; then - curl -o appimage_runtime -L "$APPIMAGE_RUNTIME_URL" -fi - rm -f SourceGit/*.dbg mkdir -p SourceGit.AppDir/opt @@ -61,7 +53,7 @@ ln -rsf SourceGit.AppDir/opt/sourcegit/sourcegit SourceGit.AppDir/AppRun ln -rsf SourceGit.AppDir/usr/share/applications/com.sourcegit_scm.SourceGit.desktop SourceGit.AppDir cp resources/appimage/sourcegit.appdata.xml SourceGit.AppDir/usr/share/metainfo/com.sourcegit_scm.SourceGit.appdata.xml -ARCH="$appimage_arch" ./appimagetool -v --runtime-file appimage_runtime SourceGit.AppDir "sourcegit-$VERSION.linux.$arch.AppImage" +ARCH="$appimage_arch" ./appimagetool -v SourceGit.AppDir "sourcegit-$VERSION.linux.$arch.AppImage" mkdir -p resources/deb/opt/sourcegit/ mkdir -p resources/deb/usr/bin From f1d43d94a4368fb26a0cdbdde0bd00986dc04902 Mon Sep 17 00:00:00 2001 From: Aikawa Yataro Date: Sun, 11 Aug 2024 15:50:47 +0000 Subject: [PATCH 12/12] ci: disable unsupported platforms --- .github/workflows/ci.yml | 6 +++--- .github/workflows/package.yml | 3 ++- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 87d460c6..40dd41b4 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -26,9 +26,9 @@ jobs: - name : Linux os: ubuntu-20.04 runtime: linux-x64 - - name : Linux (arm64) - os: ubuntu-20.04 - runtime: linux-arm64 + # - name : Linux (arm64) + # os: ubuntu-20.04 + # runtime: linux-arm64 name: Build ${{ matrix.name }} runs-on: ${{ matrix.os }} steps: diff --git a/.github/workflows/package.yml b/.github/workflows/package.yml index 404c909e..a3063813 100644 --- a/.github/workflows/package.yml +++ b/.github/workflows/package.yml @@ -66,7 +66,8 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - runtime: [linux-x64, linux-arm64] + # runtime: [linux-x64, linux-arm64] + runtime: [linux-x64] steps: - name: Checkout sources uses: actions/checkout@v4