chore: improve github action (#105)
* fix build step * fix ci * fix build * fix ci on linux * . * fix flatpak * . * . * . * fix snap * . * . * . * . * fix * . * . * fix path * . * . * fix upload artifacts * fix build on arm * fix snap arm * . * .
This commit is contained in:
80
.github/workflows/release.yml
vendored
80
.github/workflows/release.yml
vendored
@@ -18,10 +18,10 @@ jobs:
|
||||
os: windows-latest
|
||||
target: x86_64-pc-windows-msvc
|
||||
- platform: windows-arm64
|
||||
os: windows-latest
|
||||
os: windows-11-arm
|
||||
target: aarch64-pc-windows-msvc
|
||||
- platform: macos-x64
|
||||
os: macos-latest
|
||||
os: macos-13
|
||||
target: x86_64-apple-darwin
|
||||
- platform: macos-arm64
|
||||
os: macos-latest
|
||||
@@ -30,7 +30,7 @@ jobs:
|
||||
os: ubuntu-latest
|
||||
target: x86_64-unknown-linux-gnu
|
||||
- platform: linux-arm64
|
||||
os: ubuntu-latest
|
||||
os: ubuntu-24.04-arm
|
||||
target: aarch64-unknown-linux-gnu
|
||||
|
||||
steps:
|
||||
@@ -48,7 +48,7 @@ jobs:
|
||||
working-directory: crates/coop
|
||||
run: |
|
||||
cargo install cargo-packager --locked
|
||||
cargo packager --release --target ${{ matrix.target }} --config before-packaging-command="cargo build --release --target ${{ matrix.target }}"
|
||||
cargo packager --release
|
||||
|
||||
- name: Upload Windows/macOS artifacts
|
||||
if: runner.os != 'Linux'
|
||||
@@ -56,9 +56,9 @@ jobs:
|
||||
with:
|
||||
name: ${{ matrix.platform }}-artifacts
|
||||
path: |
|
||||
crates/coop/dist/*.dmg
|
||||
crates/coop/dist/*.msi
|
||||
crates/coop/dist/*.exe
|
||||
dist/*.dmg
|
||||
dist/*.msi
|
||||
dist/*.exe
|
||||
if-no-files-found: error
|
||||
|
||||
# Linux builds using custom scripts
|
||||
@@ -68,20 +68,6 @@ jobs:
|
||||
sudo apt-get update
|
||||
sudo apt-get install -y flatpak flatpak-builder snapd squashfs-tools jq gettext-base
|
||||
|
||||
# Install cross-compilation tools for ARM64
|
||||
- name: Install ARM64 cross-compilation tools
|
||||
if: runner.os == 'Linux' && matrix.target == 'aarch64-unknown-linux-gnu'
|
||||
run: |
|
||||
sudo apt-get install -y gcc-aarch64-linux-gnu g++-aarch64-linux-gnu
|
||||
|
||||
- name: Configure cross-compilation environment
|
||||
if: runner.os == 'Linux' && matrix.target == 'aarch64-unknown-linux-gnu'
|
||||
run: |
|
||||
echo "CC_aarch64_unknown_linux_gnu=aarch64-linux-gnu-gcc" >> $GITHUB_ENV
|
||||
echo "CXX_aarch64_unknown_linux_gnu=aarch64-linux-gnu-g++" >> $GITHUB_ENV
|
||||
echo "AR_aarch64_unknown_linux_gnu=aarch64-linux-gnu-ar" >> $GITHUB_ENV
|
||||
echo "CARGO_TARGET_AARCH64_UNKNOWN_LINUX_GNU_LINKER=aarch64-linux-gnu-gcc" >> $GITHUB_ENV
|
||||
|
||||
- name: Install Snapcraft
|
||||
if: runner.os == 'Linux'
|
||||
run: sudo snap install snapcraft --classic
|
||||
@@ -91,53 +77,41 @@ jobs:
|
||||
run: |
|
||||
chmod +x script/get-crate-version
|
||||
chmod +x script/linux
|
||||
chmod +x script/snap-build
|
||||
chmod +x script/bundle-snap
|
||||
chmod +x script/bundle-linux
|
||||
chmod +x script/flatpak/deps
|
||||
chmod +x script/flatpak/bundle-flatpak
|
||||
|
||||
- name: Install required dependencies
|
||||
if: runner.os == 'Linux'
|
||||
working-directory: script
|
||||
run: ./linux
|
||||
run: ./script/linux
|
||||
|
||||
# Only build Flatpak and Snap for x86_64 (most common use case)
|
||||
- name: Build Flatpak (x86_64 only)
|
||||
if: runner.os == 'Linux' && matrix.target == 'x86_64-unknown-linux-gnu'
|
||||
working-directory: script/flatpak
|
||||
- name: Build Flatpak
|
||||
if: runner.os == 'Linux'
|
||||
run: |
|
||||
./deps
|
||||
./bundle-flatpak
|
||||
./script/bundle-linux --flatpak
|
||||
./script/flatpak/deps
|
||||
./script/flatpak/bundle-flatpak
|
||||
|
||||
- name: Build Snap (x86_64 only)
|
||||
if: runner.os == 'Linux' && matrix.target == 'x86_64-unknown-linux-gnu'
|
||||
- name: Build Snap
|
||||
if: runner.os == 'Linux'
|
||||
run: |
|
||||
VERSION=$(script/get-crate-version coop)
|
||||
script/snap-build $VERSION
|
||||
./script/bundle-linux
|
||||
./script/bundle-snap $VERSION
|
||||
|
||||
# For ARM64, build a simple binary package
|
||||
- name: Build ARM64 binary
|
||||
if: runner.os == 'Linux' && matrix.target == 'aarch64-unknown-linux-gnu'
|
||||
run: |
|
||||
cargo build --release --target ${{ matrix.target }}
|
||||
|
||||
- name: Create ARM64 tarball
|
||||
if: runner.os == 'Linux' && matrix.target == 'aarch64-unknown-linux-gnu'
|
||||
run: |
|
||||
VERSION=$(script/get-crate-version coop)
|
||||
mkdir -p linux-artifacts
|
||||
cd target/aarch64-unknown-linux-gnu/release
|
||||
tar -czf ../../../linux-artifacts/coop-${VERSION}-linux-aarch64.tar.gz coop
|
||||
ls -la ../../../linux-artifacts/
|
||||
|
||||
- name: Collect Linux x86_64 artifacts
|
||||
if: runner.os == 'Linux' && matrix.target == 'x86_64-unknown-linux-gnu'
|
||||
- name: Collect Linux artifacts
|
||||
if: runner.os == 'Linux'
|
||||
working-directory: ${{ github.workspace }}
|
||||
run: |
|
||||
mkdir -p linux-artifacts
|
||||
# Find and copy flatpak files
|
||||
find . -name "*.flatpak" -exec cp {} linux-artifacts/ \;
|
||||
# Find and copy snap files
|
||||
find . -name "*.snap" -exec cp {} linux-artifacts/ \;
|
||||
# Copy the tarball created by bundle-linux
|
||||
find target/release -name "*.tar.gz" -exec cp {} linux-artifacts/ \;
|
||||
# Find and copy flatpak files (if they exist)
|
||||
find . -name "*.flatpak" -exec cp {} linux-artifacts/ \; || true
|
||||
# Find and copy snap files (if they exist)
|
||||
find . -name "*.snap" -exec cp {} linux-artifacts/ \; || true
|
||||
ls -la linux-artifacts/
|
||||
|
||||
- name: Upload Linux artifacts
|
||||
|
||||
Reference in New Issue
Block a user