|
| 1 | +name: .NET Build and Release |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + branches: [ "master" ] |
| 6 | + pull_request: |
| 7 | + branches: [ "master" ] |
| 8 | + workflow_dispatch: |
| 9 | + |
| 10 | +jobs: |
| 11 | + build-windows: |
| 12 | + name: Build on Windows |
| 13 | + runs-on: windows-latest |
| 14 | + steps: |
| 15 | + - name: Checkout |
| 16 | + uses: actions/checkout@v4 |
| 17 | + |
| 18 | + - name: Setup .NET |
| 19 | + uses: actions/setup-dotnet@v4 |
| 20 | + with: |
| 21 | + dotnet-version: 9.0.x |
| 22 | + |
| 23 | + - name: Build for Windows |
| 24 | + run: | |
| 25 | + dotnet publish --runtime win-x64 -c Release -o "output/win-x64" |
| 26 | +
|
| 27 | + - name: Upload Windows Artifact |
| 28 | + uses: actions/upload-artifact@v4 |
| 29 | + with: |
| 30 | + name: win-x64-artifact |
| 31 | + path: output/win-x64/task-time-tracker.exe |
| 32 | + |
| 33 | + build-macos: |
| 34 | + name: Build on macOS |
| 35 | + runs-on: macos-latest |
| 36 | + steps: |
| 37 | + - name: Checkout |
| 38 | + uses: actions/checkout@v4 |
| 39 | + |
| 40 | + - name: Setup .NET |
| 41 | + uses: actions/setup-dotnet@v4 |
| 42 | + with: |
| 43 | + dotnet-version: 9.0.x |
| 44 | + |
| 45 | + - name: Build for macOS |
| 46 | + run: | |
| 47 | + dotnet publish --runtime osx-arm64 -c Release -o "output/osx-arm64" |
| 48 | +
|
| 49 | + - name: Ad-hoc Code Signing |
| 50 | + run: | |
| 51 | + codesign --deep --force --verify --sign - output/osx-arm64/task-time-tracker |
| 52 | +
|
| 53 | + - name: Upload macOS Artifact |
| 54 | + uses: actions/upload-artifact@v4 |
| 55 | + with: |
| 56 | + name: osx-arm64-artifact |
| 57 | + path: output/osx-arm64/task-time-tracker |
| 58 | + |
| 59 | + create-release: |
| 60 | + name: Create GitHub Release and Upload Artifacts |
| 61 | + runs-on: ubuntu-latest |
| 62 | + needs: [build-windows, build-macos] |
| 63 | + steps: |
| 64 | + - name: Download Windows Artifact |
| 65 | + uses: actions/download-artifact@v4 |
| 66 | + with: |
| 67 | + name: win-x64-artifact |
| 68 | + path: output/win-x64/ |
| 69 | + |
| 70 | + - name: Download macOS Artifact |
| 71 | + uses: actions/download-artifact@v4 |
| 72 | + with: |
| 73 | + name: osx-arm64-artifact |
| 74 | + path: output/osx-arm64/ |
| 75 | + |
| 76 | + - name: Create GitHub Release and Upload Artifacts |
| 77 | + uses: softprops/action-gh-release@v2 |
| 78 | + with: |
| 79 | + tag_name: "latest-${{ github.sha }}" |
| 80 | + name: "Auto-release" |
| 81 | + files: | |
| 82 | + output/win-x64/task-time-tracker.exe |
| 83 | + output/osx-arm64/task-time-tracker |
| 84 | + env: |
| 85 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
0 commit comments