|
| 1 | +name: Pack and nuget |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + tags: |
| 6 | + - '*' |
| 7 | + |
| 8 | +jobs: |
| 9 | + notify_pending_production_deploy: |
| 10 | + runs-on: ubuntu-latest |
| 11 | + steps: |
| 12 | + - name: Submit pending deployment notification |
| 13 | + run: | |
| 14 | + export TITLE="Pending osu Production Deployment: $GITHUB_REF_NAME" |
| 15 | + export URL="https://github.com/ppy/osu/actions/runs/$GITHUB_RUN_ID" |
| 16 | + export DESCRIPTION="Awaiting approval for building NuGet packages for tag $GITHUB_REF_NAME: |
| 17 | + [View Workflow Run]($URL)" |
| 18 | + export ACTOR_ICON="https://avatars.githubusercontent.com/u/$GITHUB_ACTOR_ID" |
| 19 | +
|
| 20 | + BODY="$(jq --null-input '{ |
| 21 | + "embeds": [ |
| 22 | + { |
| 23 | + "title": env.TITLE, |
| 24 | + "color": 15098112, |
| 25 | + "description": env.DESCRIPTION, |
| 26 | + "url": env.URL, |
| 27 | + "author": { |
| 28 | + "name": env.GITHUB_ACTOR, |
| 29 | + "icon_url": env.ACTOR_ICON |
| 30 | + } |
| 31 | + } |
| 32 | + ] |
| 33 | + }')" |
| 34 | +
|
| 35 | + curl \ |
| 36 | + -H "Content-Type: application/json" \ |
| 37 | + -d "$BODY" \ |
| 38 | + "${{ secrets.DISCORD_INFRA_WEBHOOK_URL }}" |
| 39 | +
|
| 40 | + pack: |
| 41 | + name: Pack |
| 42 | + runs-on: ubuntu-latest |
| 43 | + environment: production |
| 44 | + steps: |
| 45 | + - name: Checkout |
| 46 | + uses: actions/checkout@v4 |
| 47 | + |
| 48 | + - name: Set artifacts directory |
| 49 | + id: artifactsPath |
| 50 | + run: echo "::set-output name=nuget_artifacts::${{github.workspace}}/artifacts" |
| 51 | + |
| 52 | + - name: Install .NET 8.0.x |
| 53 | + uses: actions/setup-dotnet@v4 |
| 54 | + with: |
| 55 | + dotnet-version: "8.0.x" |
| 56 | + |
| 57 | + - name: Pack |
| 58 | + run: | |
| 59 | + # Replace project references in templates with package reference, because they're included as source files. |
| 60 | + dotnet remove Templates/Rulesets/ruleset-empty/osu.Game.Rulesets.EmptyFreeform/osu.Game.Rulesets.EmptyFreeform.csproj reference osu.Game/osu.Game.csproj |
| 61 | + dotnet remove Templates/Rulesets/ruleset-example/osu.Game.Rulesets.Pippidon/osu.Game.Rulesets.Pippidon.csproj reference osu.Game/osu.Game.csproj |
| 62 | + dotnet remove Templates/Rulesets/ruleset-scrolling-empty/osu.Game.Rulesets.EmptyScrolling/osu.Game.Rulesets.EmptyScrolling.csproj reference osu.Game/osu.Game.csproj |
| 63 | + dotnet remove Templates/Rulesets/ruleset-scrolling-example/osu.Game.Rulesets.Pippidon/osu.Game.Rulesets.Pippidon.csproj reference osu.Game/osu.Game.csproj |
| 64 | +
|
| 65 | + dotnet add Templates/Rulesets/ruleset-empty/osu.Game.Rulesets.EmptyFreeform/osu.Game.Rulesets.EmptyFreeform.csproj package ppy.osu.Game -n -v ${{ github.ref_name }} |
| 66 | + dotnet add Templates/Rulesets/ruleset-example/osu.Game.Rulesets.Pippidon/osu.Game.Rulesets.Pippidon.csproj package ppy.osu.Game -n -v ${{ github.ref_name }} |
| 67 | + dotnet add Templates/Rulesets/ruleset-scrolling-empty/osu.Game.Rulesets.EmptyScrolling/osu.Game.Rulesets.EmptyScrolling.csproj package ppy.osu.Game -n -v ${{ github.ref_name }} |
| 68 | + dotnet add Templates/Rulesets/ruleset-scrolling-example/osu.Game.Rulesets.Pippidon/osu.Game.Rulesets.Pippidon.csproj package ppy.osu.Game -n -v ${{ github.ref_name }} |
| 69 | +
|
| 70 | + # Pack |
| 71 | + dotnet pack -c Release osu.Game /p:Version=${{ github.ref_name }} /p:GenerateDocumentationFile=true /p:IncludeSymbols=true /p:SymbolPackageFormat=snupkg -o ${{steps.artifactsPath.outputs.nuget_artifacts}} |
| 72 | + dotnet pack -c Release osu.Game.Rulesets.Osu /p:Version=${{ github.ref_name }} /p:GenerateDocumentationFile=true /p:IncludeSymbols=true /p:SymbolPackageFormat=snupkg -o ${{steps.artifactsPath.outputs.nuget_artifacts}} |
| 73 | + dotnet pack -c Release osu.Game.Rulesets.Taiko /p:Version=${{ github.ref_name }} /p:GenerateDocumentationFile=true /p:IncludeSymbols=true /p:SymbolPackageFormat=snupkg -o ${{steps.artifactsPath.outputs.nuget_artifacts}} |
| 74 | + dotnet pack -c Release osu.Game.Rulesets.Catch /p:Version=${{ github.ref_name }} /p:GenerateDocumentationFile=true /p:IncludeSymbols=true /p:SymbolPackageFormat=snupkg -o ${{steps.artifactsPath.outputs.nuget_artifacts}} |
| 75 | + dotnet pack -c Release osu.Game.Rulesets.Mania /p:Version=${{ github.ref_name }} /p:GenerateDocumentationFile=true /p:IncludeSymbols=true /p:SymbolPackageFormat=snupkg -o ${{steps.artifactsPath.outputs.nuget_artifacts}} |
| 76 | + dotnet pack -c Release Templates /p:Version=${{ github.ref_name }} -o ${{steps.artifactsPath.outputs.nuget_artifacts}} |
| 77 | +
|
| 78 | + - name: Upload artifacts |
| 79 | + uses: actions/upload-artifact@v4 |
| 80 | + with: |
| 81 | + name: osu |
| 82 | + path: | |
| 83 | + ${{steps.artifactsPath.outputs.nuget_artifacts}}/*.nupkg |
| 84 | + ${{steps.artifactsPath.outputs.nuget_artifacts}}/*.snupkg |
| 85 | +
|
| 86 | + - name: Publish packages to nuget.org |
| 87 | + run: dotnet nuget push ${{steps.artifactsPath.outputs.nuget_artifacts}}/*.nupkg --api-key ${{ secrets.NUGET_API_KEY }} --source https://api.nuget.org/v3/index.json |
0 commit comments