Skip to content

Commit

Permalink
ci: Fix release packing and publish (#11)
Browse files Browse the repository at this point in the history
- Do not publish tests
- Fix permissions to publish release assets
- Support ARM64
  • Loading branch information
skarllot authored Dec 26, 2024
1 parent 24b5ca8 commit 532cf57
Show file tree
Hide file tree
Showing 5 changed files with 37 additions and 26 deletions.
24 changes: 14 additions & 10 deletions .github/workflows/dotnet.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,16 +22,20 @@ jobs:
build:
strategy:
matrix:
os: [ ubuntu-latest, macos-latest, windows-latest ]
os: [ linux, osx, win ]
arch: [ x64, arm64 ]
include:
- os: ubuntu-latest
runtime: linux-x64
- os: macos-latest
runtime: osx-x64
- os: windows-latest
runtime: win-x64
- os: linux
image: ubuntu-latest
- os: osx
image: macos-latest
- os: win
image: windows-latest
exclude:
- os: win
arch: arm64

runs-on: ${{ matrix.os }}
runs-on: ${{ matrix.image }}
defaults:
run:
shell: bash
Expand Down Expand Up @@ -84,5 +88,5 @@ jobs:

- name: ✅ Test Publish
run: |
dotnet publish -r ${{ matrix.runtime }} -c Release
7z a -tzip -mx9 flowpair-${{ matrix.runtime }}.zip $PWD/publish/*.*
dotnet publish --no-restore -r ${{ matrix.os }}-${{ matrix.arch }} -c Debug
7z a -tzip -mx9 flowpair-${{ matrix.os }}-${{ matrix.arch }}.zip $PWD/publish/*.*
34 changes: 19 additions & 15 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,16 +17,20 @@ jobs:
pack:
strategy:
matrix:
os: [ ubuntu-latest, macos-latest, windows-latest ]
os: [ linux, osx, win ]
arch: [ x64, arm64 ]
include:
- os: ubuntu-latest
runtime: linux-x64
- os: macos-latest
runtime: osx-x64
- os: windows-latest
runtime: win-x64

runs-on: ${{ matrix.os }}
- os: linux
image: ubuntu-latest
- os: osx
image: macos-latest
- os: win
image: windows-latest
exclude:
- os: win
arch: arm64

runs-on: ${{ matrix.image }}
defaults:
run:
shell: bash
Expand Down Expand Up @@ -67,24 +71,24 @@ jobs:
run: dotnet restore --locked-mode

- name: 🏗️ Build
run: dotnet build --no-restore -c Release
run: dotnet publish --no-restore -r ${{ matrix.os }}-${{ matrix.arch }} -c Release

- name: 📦 Pack
run: |
dotnet publish -r ${{ matrix.runtime }} -c Release
7z a -tzip -mx9 flowpair-${{ matrix.runtime }}-${{ github.ref_name }}.zip $PWD/publish/*.*
run: 7z a -tzip -mx9 flowpair${{ matrix.os }}-${{ matrix.arch }}-${{ github.ref_name }}.zip $PWD/publish/*.*

- name: 📤 Upload artifact
uses: actions/upload-artifact@6f51ac03b9356f520e9adb1b1b7802705f340c2b # v4.5.0
with:
name: release-${{ matrix.runtime }}-${{ github.ref_name }}
name: release-${{ matrix.os }}-${{ matrix.arch }}-${{ github.ref_name }}
path: flowpair-*.zip
retention-days: 1
overwrite: true

publish:
runs-on: ubuntu-latest
needs: pack
permissions:
contents: write

steps:
- name: 🛡️ Harden Runner
Expand All @@ -103,7 +107,7 @@ jobs:
merge-multiple: true

- name: 🚀 Publish
uses: softprops/action-gh-release@e7a8f85e1c67a31e6ed99a94b41bd0b71bbee6b8 # v2
uses: softprops/action-gh-release@7b4da11513bf3f43f9999e90eabced41ab8bb048 # v2.2.0
if: startsWith(github.ref, 'refs/tags/')
with:
files: "flowpair*.zip"
2 changes: 2 additions & 0 deletions Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,7 @@
<EnableNETAnalyzers>true</EnableNETAnalyzers>
<AnalysisMode>Recommended</AnalysisMode>
<RestorePackagesWithLockFile>true</RestorePackagesWithLockFile>
<IsPackable>false</IsPackable>
<IsPublishable>false</IsPublishable>
</PropertyGroup>
</Project>
1 change: 1 addition & 0 deletions src/FlowPair/FlowPair.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
<TargetFramework>net9.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<IsPublishable>true</IsPublishable>
<SelfContained>true</SelfContained>
<PublishSingleFile>true</PublishSingleFile>
<PublishReadyToRun>true</PublishReadyToRun>
Expand Down
2 changes: 1 addition & 1 deletion src/FlowPair/packages.lock.json
Original file line number Diff line number Diff line change
Expand Up @@ -147,4 +147,4 @@
}
}
}
}
}

0 comments on commit 532cf57

Please sign in to comment.