|
| 1 | +name: "pre-release" |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + branches: |
| 6 | + - "main" |
| 7 | + |
| 8 | +permissions: |
| 9 | + contents: write |
| 10 | + packages: write |
| 11 | + |
| 12 | +jobs: |
| 13 | + pre-release: |
| 14 | + name: "Pre Release" |
| 15 | + runs-on: "ubuntu-latest" |
| 16 | + |
| 17 | + steps: |
| 18 | + - uses: actions/checkout@v1 |
| 19 | + |
| 20 | + - name: Determine prerelease version |
| 21 | + run: | |
| 22 | + COMMIT_SHA=$(git rev-parse --short HEAD) |
| 23 | + echo "PRERELEASE_VERSION=11.0.0-${COMMIT_SHA}" >> $GITHUB_ENV |
| 24 | +
|
| 25 | + - name: Setup .NET |
| 26 | + uses: actions/setup-dotnet@v1 |
| 27 | + with: |
| 28 | + dotnet-version: '10.0.x' |
| 29 | + |
| 30 | + - name: Install zip |
| 31 | + uses: montudor/action-zip@v1 |
| 32 | + |
| 33 | + - name: Build with dotnet |
| 34 | + working-directory: ./src/Spice86.Audio |
| 35 | + run: | |
| 36 | + dotnet publish -c Release -r linux-x64 --self-contained true -p:PublishReadyToRunComposite=true -p:PublishSingleFile=true -o ../Release/linux |
| 37 | + dotnet publish -c Release -r linux-arm64 --self-contained true -p:PublishReadyToRunComposite=true -p:PublishSingleFile=true -o ../Release/linux-arm64 |
| 38 | + dotnet publish -c Release -r win-arm64 --self-contained true -p:PublishReadyToRunComposite=true -p:PublishSingleFile=true -o ../Release/windows-arm64 |
| 39 | + dotnet publish -c Release -r win-x64 --self-contained true -p:PublishReadyToRunComposite=true -p:PublishSingleFile=true -o ../Release/windows |
| 40 | + dotnet publish -c Release -r osx-x64 --self-contained true -p:PublishReadyToRunComposite=true -p:PublishSingleFile=true -o ../Release/macos |
| 41 | + dotnet publish -c Release -r osx-arm64 --self-contained true -p:PublishReadyToRunComposite=true -p:PublishSingleFile=true -o ../Release/macos-arm64 |
| 42 | + dotnet publish -c Debug -r linux-x64 --self-contained true -p:PublishReadyToRunComposite=true -p:PublishSingleFile=true -o ../Debug/linux |
| 43 | + dotnet publish -c Debug -r linux-arm64 --self-contained true -p:PublishReadyToRunComposite=true -p:PublishSingleFile=true -o ../Debug/linux-arm64 |
| 44 | + dotnet publish -c Debug -r win-arm64 --self-contained true -p:PublishReadyToRunComposite=true -p:PublishSingleFile=true -o ../Debug/windows-arm64 |
| 45 | + dotnet publish -c Debug -r win-x64 --self-contained true -p:PublishReadyToRunComposite=true -p:PublishSingleFile=true -o ../Debug/windows |
| 46 | + dotnet publish -c Debug -r osx-x64 --self-contained true -p:PublishReadyToRunComposite=true -p:PublishSingleFile=true -o ../Debug/macos |
| 47 | + dotnet publish -c Debug -r osx-arm64 --self-contained true -p:PublishReadyToRunComposite=true -p:PublishSingleFile=true -o ../Debug/macos-arm64 |
| 48 | +
|
| 49 | + - name: Zip Debug output |
| 50 | + run: zip -qq -r DebugBuild.zip Debug |
| 51 | + working-directory: ./src/Spice86.Audio/bin |
| 52 | + |
| 53 | + - name: Zip Release output |
| 54 | + run: zip -qq -r ReleaseBuild.zip Release |
| 55 | + working-directory: ./src/Spice86.Audio/bin |
| 56 | + |
| 57 | + # Suppress the following warnings during NuGet packing: |
| 58 | + # 1591 - Missing XML documentation |
| 59 | + # NU5104 - Package icon issues |
| 60 | + # NU1507 - Package validation issues |
| 61 | + # Semicolons are URL-encoded as %3B for compatibility. |
| 62 | + - name: Pack prerelease NuGet packages |
| 63 | + working-directory: ./src |
| 64 | + run: dotnet pack Spice86.Audio.slnx --configuration Release --include-symbols --include-source -p:PackageVersion=${PRERELEASE_VERSION} -p:SymbolPackageFormat=snupkg -p:NoWarn=1591%3BNU5104%3BNU1507 |
| 65 | + |
| 66 | + - name: Publish prerelease NuGet packages |
| 67 | + env: |
| 68 | + PACKAGE_VERSION: ${{ env.PRERELEASE_VERSION }} |
| 69 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 70 | + run: | |
| 71 | + set -euo pipefail |
| 72 | + SOURCE="https://nuget.pkg.github.com/${{ github.repository_owner }}/index.json" |
| 73 | + for project in Spice86.Audio; do |
| 74 | + PACKAGE_PATH="./src/${project}/bin/Release/${project}.${PACKAGE_VERSION}.nupkg" |
| 75 | + if [ -f "$PACKAGE_PATH" ]; then |
| 76 | + dotnet nuget push "$PACKAGE_PATH" --source "$SOURCE" --api-key "$GITHUB_TOKEN" --skip-duplicate |
| 77 | + else |
| 78 | + echo "::error::Package not found: $PACKAGE_PATH" |
| 79 | + exit 1 |
| 80 | + fi |
| 81 | + done |
| 82 | +
|
| 83 | + - name: Publish GitHub Release |
| 84 | + uses: "marvinpinto/action-automatic-releases@latest" |
| 85 | + with: |
| 86 | + repo_token: "${{ secrets.GITHUB_TOKEN }}" |
| 87 | + automatic_release_tag: "latest" |
| 88 | + prerelease: true |
| 89 | + title: "Development Build" |
| 90 | + files: | |
| 91 | + ./src/Spice86/bin/DebugBuild.zip |
| 92 | + ./src/Spice86/bin/ReleaseBuild.zip |
0 commit comments