From 64525c7284b191575a395bb81c507c27d92de748 Mon Sep 17 00:00:00 2001 From: u8slvn Date: Tue, 27 Aug 2024 09:22:52 +0200 Subject: [PATCH] build: add create dmg script --- .github/workflows/ci.yml | 12 ++++++------ .github/workflows/release.yml | 21 +++++++++------------ scripts/create-dmg.sh | 13 +++++++++++++ 3 files changed, 28 insertions(+), 18 deletions(-) create mode 100755 scripts/create-dmg.sh diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 19305a7..03c7b19 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -14,16 +14,16 @@ jobs: fail-fast: false matrix: python-version: ["3.12"] - os: [ Ubuntu, macOS, Windows ] + os: [ Ubuntu, macOS-x86_64, macOS-arm64, Windows ] include: - os: Ubuntu - image: ubuntu-22.04 + image: ubuntu-latest - os: Windows - image: windows-2022 - - os: macOS x86_64 + image: windows-latest + - os: macOS-x86_64 image: macos-13 - - os: macOS arm64 - image: macos-14 + - os: macOS-arm64 + image: macos-latest defaults: run: shell: bash diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 5f9023b..35a41e9 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -1,12 +1,12 @@ -name: build +name: release on: push: tags: - "v*.*.*" jobs: release-windows: - name: build-${{ matrix.arch }} - runs-on: windows-latest + name: build-windows-${{ matrix.arch }} + runs-on: windows-2022 strategy: fail-fast: false matrix: @@ -56,7 +56,7 @@ jobs: # with: # files: dist/doggo-*.exe - build-macos: + release-macos: name: build-macos-${{ matrix.arch }} runs-on: macos-${{ matrix.os-version }} strategy: @@ -66,10 +66,8 @@ jobs: include: - os-version: 13 arch: x86_64 - arch-name: Intel - os-version: 14 arch: aarch64 - arch-name: AppleSilicon defaults: run: shell: bash @@ -97,14 +95,13 @@ jobs: run: | poetry run python scripts/build.py --os macos - - name: Sign app - run: codesign --force --deep -s - ./dist/doggo-*.app -# brew install create-dmg -# VERSION=$(grep -m 1 version pyproject.toml | grep -e '\d.\d.\d' -o) -# create-dmg --volname "Doggo" --no-internet-enable "doggo-$VERSION-${{ matrix.arch-name }}.dmg" "./dist/doggo-$VERSION-macos.app" + - name: Create DMG + run: | + brew install create-dmg + ./scripts/create-dmg.sh - name: Archive production artifacts uses: actions/upload-artifact@v4 with: name: macos-${{ matrix.arch-name }} - path: ${{ github.workspace }}/dist/doggo-*.app + path: ${{ github.workspace }}/doggo-*.dmg diff --git a/scripts/create-dmg.sh b/scripts/create-dmg.sh new file mode 100755 index 0000000..bf93e49 --- /dev/null +++ b/scripts/create-dmg.sh @@ -0,0 +1,13 @@ +#!/bin/bash + +ARCH_NAME=$([[ "$(arch)" = "arm64" ]] && echo "AppleSilicon" || echo "Intel") +VERSION=$(poetry version --short) + +mkdir ./dist/dmg +mv ./dist/doggo-*.app ./dist/dmg/Doggo.app + +create-dmg \ + --volname "Doggo" \ + --hide-extension "Doggo.app" \ + "doggo-$VERSION-$ARCH_NAME.dmg" \ + "./dist/dmg/Doggo.app"