Repository navigation
144 lines (125 loc) Β· 4.25 KB
/
Copy pathrelease.yml
File metadata and controls
144 lines (125 loc) Β· 4.25 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
name: Package and NuGet
on:
push:
tags:
- "[0-9]+.[0-9]+.[0-9]+*"
permissions:
contents: read
jobs:
notify_process_deploy:
name: Notify start
runs-on: ubuntu-latest
continue-on-error: true
env:
WEBHOOK_URL: ${{ secrets.DISCORD_INFRA_WEBHOOK_URL }}
steps:
- name: Notify Deployment
run: |
export TITLE="π Deployment in Progress: libmsdf ($GITHUB_REF_NAME)"
export URL="$GITHUB_SERVER_URL/$GITHUB_REPOSITORY/actions/runs/$GITHUB_RUN_ID"
export DESCRIPTION="A new deployment for **libmsdf** has started."$'\n'"Stay tuned for updates!"$'\n'"β [View Workflow Run]($URL)"
export ACTOR_ICON="https://avatars.githubusercontent.com/u/$GITHUB_ACTOR_ID"
BODY="$(jq --null-input '{
embeds: [{
title: env.TITLE,
color: 15098112,
description: env.DESCRIPTION,
url: env.URL,
author: { name: env.GITHUB_ACTOR, icon_url: env.ACTOR_ICON }
}]
}')"
curl --fail -H "Content-Type: application/json" -d "$BODY" "$WEBHOOK_URL"
test:
name: Test (${{ matrix.threadingMode }})
runs-on: ubuntu-latest
timeout-minutes: 30
strategy:
fail-fast: true
matrix:
threadingMode: ["SingleThread", "MultiThreaded"]
env:
OSU_EXECUTION_MODE: ${{ matrix.threadingMode }}
steps:
- name: Checkout
uses: actions/checkout@v4
with:
persist-credentials: false
- name: Install .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: "10.0.x"
- name: Test
run: dotnet test -c Release
pack:
name: Pack (libmsdf)
needs: [test]
runs-on: ubuntu-latest
environment: production
timeout-minutes: 15
permissions:
contents: read
id-token: write
env:
ARTIFACTS: ${{ github.workspace }}/artifacts
VERSION: ${{ github.ref_name }}
steps:
- name: Checkout
uses: actions/checkout@v4
with:
persist-credentials: false
- name: Install .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: "10.0.x"
- name: Pack (libmsdf)
run: dotnet pack lib -c Release /p:Version="${VERSION#v}" -o "$ARTIFACTS"
- name: Upload artifacts
uses: actions/upload-artifact@v4
with:
name: libmsdf
path: ${{ github.workspace }}/artifacts/*.nupkg
if-no-files-found: error
- name: NuGet login (OIDC)
id: login
uses: NuGet/login@8d196754b4036150537f80ac539e15c2f1028841
with:
user: ${{ vars.NUGET_USER }}
- name: Publish packages to NuGet
env:
NUGET_API_KEY: ${{ steps.login.outputs.NUGET_API_KEY }}
run: >
dotnet nuget push "$ARTIFACTS"/*.nupkg
--api-key "$NUGET_API_KEY"
--source https://api.nuget.org/v3/index.json
--skip-duplicate
notify_status_deploy:
name: Notify result
needs: [test, pack]
if: always()
runs-on: ubuntu-latest
continue-on-error: true
env:
PACK_RESULT: ${{ needs.pack.result }}
WEBHOOK_URL: ${{ secrets.DISCORD_INFRA_WEBHOOK_URL }}
steps:
- name: Notify Deployment Status
run: |
export TITLE="π Deployment Completed: libmsdf ($GITHUB_REF_NAME)"
export URL="$GITHUB_SERVER_URL/$GITHUB_REPOSITORY/actions/runs/$GITHUB_RUN_ID"
if [ "$PACK_RESULT" = "success" ]; then
STATUS="β
Deployment successful!"; export COLOR=3066993
else
STATUS="β Deployment failed. Check logs for details."; export COLOR=15158332
fi
export DESCRIPTION="Deployment for **libmsdf** has finished."$'\n'"$STATUS"$'\n'"β [View Workflow Run]($URL)"
export ACTOR_ICON="https://avatars.githubusercontent.com/u/$GITHUB_ACTOR_ID"
BODY="$(jq --null-input '{
embeds: [{
title: env.TITLE,
color: (env.COLOR | tonumber),
description: env.DESCRIPTION,
url: env.URL,
author: { name: env.GITHUB_ACTOR, icon_url: env.ACTOR_ICON }
}]
}')"
curl --fail -H "Content-Type: application/json" -d "$BODY" "$WEBHOOK_URL"