ci: enhance Linux and Windows package workflow (#1071)

* ci: fix Linux packaging workflow with specific Ubuntu 20.04 image

* ci: use Compress-Archive in Windows try to prevent Defender false positives
This commit is contained in:
Gadfly 2025-03-10 09:28:13 +08:00 committed by GitHub
parent 978801c9ff
commit 6ba26770c4
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 14 additions and 6 deletions

View file

@ -9,7 +9,7 @@ on:
jobs: jobs:
windows: windows:
name: Package Windows name: Package Windows
runs-on: ubuntu-latest runs-on: windows-2019
strategy: strategy:
matrix: matrix:
runtime: [ win-x64, win-arm64 ] runtime: [ win-x64, win-arm64 ]
@ -22,6 +22,7 @@ jobs:
name: sourcegit.${{ matrix.runtime }} name: sourcegit.${{ matrix.runtime }}
path: build/SourceGit path: build/SourceGit
- name: Package - name: Package
shell: bash
env: env:
VERSION: ${{ inputs.version }} VERSION: ${{ inputs.version }}
RUNTIME: ${{ matrix.runtime }} RUNTIME: ${{ matrix.runtime }}
@ -69,6 +70,7 @@ jobs:
linux: linux:
name: Package Linux name: Package Linux
runs-on: ubuntu-latest runs-on: ubuntu-latest
container: ubuntu:20.04
strategy: strategy:
matrix: matrix:
runtime: [linux-x64, linux-arm64] runtime: [linux-x64, linux-arm64]
@ -77,9 +79,10 @@ jobs:
uses: actions/checkout@v4 uses: actions/checkout@v4
- name: Download package dependencies - name: Download package dependencies
run: | run: |
sudo add-apt-repository universe export DEBIAN_FRONTEND=noninteractive
sudo apt-get update ln -fs /usr/share/zoneinfo/Etc/UTC /etc/localtime
sudo apt-get install desktop-file-utils rpm libfuse2 apt-get update
apt-get install -y curl wget git dpkg-dev fakeroot tzdata zip unzip desktop-file-utils rpm libfuse2 file build-essential binutils
- name: Download build - name: Download build
uses: actions/download-artifact@v4 uses: actions/download-artifact@v4
with: with:
@ -89,6 +92,7 @@ jobs:
env: env:
VERSION: ${{ inputs.version }} VERSION: ${{ inputs.version }}
RUNTIME: ${{ matrix.runtime }} RUNTIME: ${{ matrix.runtime }}
APPIMAGE_EXTRACT_AND_RUN: 1
run: | run: |
mkdir build/SourceGit mkdir build/SourceGit
tar -xf "build/sourcegit.${{ matrix.runtime }}.tar" -C build/SourceGit tar -xf "build/sourcegit.${{ matrix.runtime }}.tar" -C build/SourceGit

View file

@ -9,4 +9,8 @@ cd build
rm -rf SourceGit/*.pdb rm -rf SourceGit/*.pdb
if [[ "$OSTYPE" == "msys" || "$OSTYPE" == "cygwin" || "$OSTYPE" == "win32" ]]; then
powershell -Command "Compress-Archive -Path SourceGit\\* -DestinationPath \"sourcegit_$VERSION.$RUNTIME.zip\" -Force"
else
zip "sourcegit_$VERSION.$RUNTIME.zip" -r SourceGit zip "sourcegit_$VERSION.$RUNTIME.zip" -r SourceGit
fi