Merge pull request #373 from aikawayataro/fix-macos-app

Fix missing permissions for OSX app
This commit is contained in:
leo 2024-08-20 10:32:56 +08:00 committed by GitHub
commit b0d3d302bb
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 96 additions and 72 deletions

68
.github/workflows/build.yml vendored Normal file
View file

@ -0,0 +1,68 @@
name: Build
on:
workflow_call:
jobs:
build:
strategy:
matrix:
include:
- 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
- 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
- name: Setup .NET
uses: actions/setup-dotnet@v4
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
deb [arch=arm64] http://ports.ubuntu.com/ubuntu-ports/ focal-updates main restricted
deb [arch=arm64] http://ports.ubuntu.com/ubuntu-ports/ focal-backports main restricted' \
| sudo tee /etc/apt/sources.list.d/arm64.list
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 ${{ matrix.runtime }}
- name: Rename executable file
if: ${{ startsWith(matrix.runtime, 'linux-') }}
run: mv publish/SourceGit publish/sourcegit
- name: Tar artifact
if: ${{ startsWith(matrix.runtime, 'linux-') || startsWith(matrix.runtime, 'osx-') }}
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:
name: sourcegit.${{ matrix.runtime }}
path: publish/*

View file

@ -8,66 +8,22 @@ on:
workflow_call: workflow_call:
jobs: jobs:
build: build:
strategy: name: Build
matrix: uses: ./.github/workflows/build.yml
include: version:
- name : Windows x64 name: Prepare version string
os: windows-2019 runs-on: ubuntu-latest
runtime: win-x64 outputs:
- name : Windows ARM64 version: ${{ steps.version.outputs.version }}
os: windows-2019
runtime: win-arm64
- 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: steps:
- name: Checkout sources - name: Checkout sources
uses: actions/checkout@v4 uses: actions/checkout@v4
- name: Setup .NET - name: Output version string
uses: actions/setup-dotnet@v4 id: version
with: run: echo "version=$(cat VERSION)" >> "$GITHUB_OUTPUT"
dotnet-version: 8.0.x package:
- name: Configure arm64 packages needs: [build, version]
if: ${{ matrix.runtime == 'linux-arm64' }} name: Package
run: | uses: ./.github/workflows/package.yml
sudo dpkg --add-architecture arm64 with:
echo 'deb [arch=arm64] http://ports.ubuntu.com/ubuntu-ports/ focal main restricted version: ${{ needs.version.outputs.version }}
deb [arch=arm64] http://ports.ubuntu.com/ubuntu-ports/ focal-updates main restricted
deb [arch=arm64] http://ports.ubuntu.com/ubuntu-ports/ focal-backports main restricted' \
| sudo tee /etc/apt/sources.list.d/arm64.list
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 ${{ matrix.runtime }}
- 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:
name: sourcegit.${{ matrix.runtime }}
path: publish

View file

@ -7,12 +7,8 @@ on:
required: true required: true
type: string type: string
jobs: jobs:
build:
name: Build
uses: ./.github/workflows/ci.yml
windows-portable: windows-portable:
name: Package portable Windows app name: Package portable Windows app
needs: build
runs-on: ubuntu-latest runs-on: ubuntu-latest
strategy: strategy:
matrix: matrix:
@ -37,7 +33,6 @@ jobs:
path: build/sourcegit_*.zip path: build/sourcegit_*.zip
osx-app: osx-app:
name: Package OSX app name: Package OSX app
needs: build
runs-on: ubuntu-latest runs-on: ubuntu-latest
strategy: strategy:
matrix: matrix:
@ -49,12 +44,15 @@ jobs:
uses: actions/download-artifact@v4 uses: actions/download-artifact@v4
with: with:
name: sourcegit.${{ matrix.runtime }} name: sourcegit.${{ matrix.runtime }}
path: build/SourceGit path: build
- name: Package - name: Package
env: env:
VERSION: ${{ inputs.version }} VERSION: ${{ inputs.version }}
RUNTIME: ${{ matrix.runtime }} RUNTIME: ${{ matrix.runtime }}
run: ./build/scripts/package.osx-app.sh run: |
mkdir build/SourceGit
tar -xf "build/sourcegit.${{ matrix.runtime }}.tar" -C build/SourceGit
./build/scripts/package.osx-app.sh
- name: Upload package artifact - name: Upload package artifact
uses: actions/upload-artifact@v4 uses: actions/upload-artifact@v4
with: with:
@ -62,7 +60,6 @@ jobs:
path: build/sourcegit_*.zip path: build/sourcegit_*.zip
linux: linux:
name: Package Linux name: Package Linux
needs: build
runs-on: ubuntu-latest runs-on: ubuntu-latest
strategy: strategy:
matrix: matrix:

View file

@ -4,6 +4,9 @@ on:
tags: tags:
- v* - v*
jobs: jobs:
build:
name: Build
uses: ./.github/workflows/build.yml
version: version:
name: Prepare version string name: Prepare version string
runs-on: ubuntu-latest runs-on: ubuntu-latest
@ -16,13 +19,13 @@ jobs:
TAG: ${{ github.ref_name }} TAG: ${{ github.ref_name }}
run: echo "version=${TAG#v}" >> "$GITHUB_OUTPUT" run: echo "version=${TAG#v}" >> "$GITHUB_OUTPUT"
package: package:
needs: version needs: [build, version]
name: Package name: Package
uses: ./.github/workflows/package.yml uses: ./.github/workflows/package.yml
with: with:
version: ${{ needs.version.outputs.version }} version: ${{ needs.version.outputs.version }}
release: release:
needs: [version, package] needs: [package, version]
name: Release name: Release
runs-on: ubuntu-latest runs-on: ubuntu-latest
permissions: permissions:
@ -34,7 +37,8 @@ jobs:
env: env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
TAG: ${{ github.ref_name }} TAG: ${{ github.ref_name }}
run: gh release create "$TAG" -t "Release ${TAG#v}" --notes-from-tag VERSION: ${{ needs.version.outputs.version }}
run: gh release create "$TAG" -t "Release $VERSION" --notes-from-tag
- name: Download artifacts - name: Download artifacts
uses: actions/download-artifact@v4 uses: actions/download-artifact@v4
with: with:
@ -45,5 +49,4 @@ jobs:
env: env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
TAG: ${{ github.ref_name }} TAG: ${{ github.ref_name }}
VERSION: ${{ needs.version.outputs.version }}
run: gh release upload "$TAG" packages/* run: gh release upload "$TAG" packages/*