1818 DOTNET_NOLOGO : true
1919 DOTNET_CLI_TELEMETRY_OPTOUT : true
2020 NUKE_TELEMETRY_OPTOUT : true
21+ ENABLE_ANDROID : ' false'
22+ ENABLE_IOS : ' false'
2123
2224jobs :
2325 resolve-version :
2426 name : Resolve Version
2527 runs-on : ubuntu-latest
2628 timeout-minutes : 5
29+ permissions :
30+ actions : write
31+ contents : read
2732 outputs :
2833 version : ${{ steps.resolve.outputs.version }}
2934 tag : ${{ steps.resolve.outputs.tag }}
3338
3439 steps :
3540 - uses : actions/checkout@v6
41+ with :
42+ fetch-tags : true
3643
3744 - name : Resolve version and context
3845 id : resolve
@@ -65,16 +72,88 @@ jobs:
6572 echo "is_release=$IS_RELEASE" >> "$GITHUB_OUTPUT"
6673 echo "Resolved: version=$VERSION tag=$TAG sha=$SHA is_release=$IS_RELEASE"
6774
75+ - name : Version summary
76+ shell : bash
77+ env :
78+ GH_TOKEN : ${{ github.token }}
79+ run : |
80+ VERSION="${{ steps.resolve.outputs.version }}"
81+ IS_RELEASE="${{ steps.resolve.outputs.is_release }}"
82+ SHA="${{ steps.resolve.outputs.sha }}"
83+
84+ IFS='.' read -r CUR_MAJOR CUR_MINOR CUR_PATCH <<< "$VERSION"
85+
86+ git fetch --tags --force
87+ PREV_TAG=$(git describe --tags --abbrev=0 2>/dev/null || echo "")
88+ if [ -n "$PREV_TAG" ]; then
89+ PREV_VER="${PREV_TAG#v}"
90+ IFS='.' read -r PRE_MAJOR PRE_MINOR PRE_PATCH <<< "$PREV_VER"
91+ if [ "$CUR_MAJOR" != "$PRE_MAJOR" ]; then
92+ BUMP="MAJOR"
93+ elif [ "$CUR_MINOR" != "$PRE_MINOR" ]; then
94+ BUMP="MINOR"
95+ elif [ "$CUR_PATCH" != "$PRE_PATCH" ]; then
96+ BUMP="PATCH"
97+ else
98+ BUMP="NONE (same as $PREV_TAG)"
99+ fi
100+ else
101+ PREV_TAG="(none)"
102+ BUMP="INITIAL"
103+ fi
104+
105+ if [ "$IS_RELEASE" = "true" ]; then
106+ RUN_NAME="v${VERSION} (${BUMP}) #${{ github.run_number }}"
107+ else
108+ RUN_NAME="v${VERSION}-ci.${{ github.run_number }} (${BUMP}) PR"
109+ fi
110+
111+ gh api -X PATCH "/repos/${{ github.repository }}/actions/runs/${{ github.run_id }}" \
112+ -f "name=$RUN_NAME" || echo "::warning::Failed to update run name"
113+
114+ MODE=$( [ "$IS_RELEASE" = "true" ] && echo "Release" || echo "CI" )
115+
116+ {
117+ echo "## Version Info"
118+ echo ""
119+ echo "| Property | Value |"
120+ echo "|----------|-------|"
121+ echo "| **Version** | \`$VERSION\` |"
122+ echo "| **Tag** | \`v$VERSION\` |"
123+ echo "| **Previous Tag** | \`$PREV_TAG\` |"
124+ echo "| **Bump Type** | **$BUMP** |"
125+ echo "| **Mode** | $MODE |"
126+ echo "| **Commit** | \`${SHA::8}\` |"
127+ } >> "$GITHUB_STEP_SUMMARY"
128+
68129 - name : Compute build matrix
69130 id : matrix
70131 shell : bash
71132 run : |
72133 IS_RELEASE="${{ steps.resolve.outputs.is_release }}"
73134 if [ "$IS_RELEASE" = "true" ]; then
74- MATRIX='{"include":[{"os":"ubuntu-latest","runtime":"linux-x64","pack":true},{"os":"windows-latest","runtime":"win-x64","pack":false},{"os":"macos-latest","runtime":"osx-arm64","pack":false}]}'
135+ ENTRIES='{"os":"ubuntu-latest","runtime":"linux-x64","pack":true,"publish":true,"workloads":""}'
136+ ENTRIES+=',{"os":"windows-latest","runtime":"win-x64","pack":false,"publish":true,"workloads":""}'
137+ ENTRIES+=',{"os":"macos-latest","runtime":"osx-arm64","pack":false,"publish":true,"workloads":""}'
138+
139+ if [ "$ENABLE_ANDROID" = "true" ]; then
140+ ENTRIES+=',{"os":"ubuntu-latest","runtime":"android","pack":false,"publish":false,"workloads":"android"}'
141+ fi
142+ if [ "$ENABLE_IOS" = "true" ]; then
143+ ENTRIES+=',{"os":"macos-latest","runtime":"ios","pack":false,"publish":false,"workloads":"ios"}'
144+ fi
75145 else
76- MATRIX='{"include":[{"os":"ubuntu-latest","runtime":"linux-x64","pack":false}]}'
146+ ENTRIES='{"os":"ubuntu-latest","runtime":"linux-x64","pack":false,"publish":false,"workloads":""}'
147+
148+ if [ "$ENABLE_ANDROID" = "true" ]; then
149+ ENTRIES+=',{"os":"ubuntu-latest","runtime":"android","pack":false,"publish":false,"workloads":"android"}'
150+ fi
151+ if [ "$ENABLE_IOS" = "true" ]; then
152+ ENTRIES+=',{"os":"macos-latest","runtime":"ios","pack":false,"publish":false,"workloads":"ios"}'
153+ fi
77154 fi
155+
156+ MATRIX="{\"include\":[$ENTRIES]}"
78157 echo "build_matrix=$MATRIX" >> "$GITHUB_OUTPUT"
79158 echo "Matrix: $MATRIX"
80159
@@ -102,6 +181,10 @@ jobs:
102181 key : ${{ runner.os }}-nuget-${{ hashFiles('**/*.csproj', 'global.json', '.config/dotnet-tools.json') }}
103182 restore-keys : ${{ runner.os }}-nuget-
104183
184+ - name : Install .NET workloads
185+ if : matrix.workloads != ''
186+ run : dotnet workload install ${{ matrix.workloads }}
187+
105188 - name : Build and test
106189 if : runner.os != 'Windows'
107190 shell : bash
@@ -153,12 +236,12 @@ jobs:
153236 echo "All packages match version: $EXPECTED_VERSION"
154237
155238 - name : Publish app
156- if : needs.resolve-version.outputs.is_release == 'true' && runner.os != 'Windows'
239+ if : needs.resolve-version.outputs.is_release == 'true' && matrix.publish && runner.os != 'Windows'
157240 shell : bash
158241 run : ./build.sh Publish --Runtime "${{ matrix.runtime }}"
159242
160243 - name : Publish app (Windows)
161- if : needs.resolve-version.outputs.is_release == 'true' && runner.os == 'Windows'
244+ if : needs.resolve-version.outputs.is_release == 'true' && matrix.publish && runner.os == 'Windows'
162245 shell : pwsh
163246 run : ./build.ps1 Publish --Runtime "${{ matrix.runtime }}"
164247
@@ -179,7 +262,7 @@ jobs:
179262 if-no-files-found : error
180263
181264 - name : Upload app artifacts
182- if : needs.resolve-version.outputs.is_release == 'true'
265+ if : needs.resolve-version.outputs.is_release == 'true' && matrix.publish
183266 uses : actions/upload-artifact@v7
184267 with :
185268 name : app-${{ matrix.runtime }}
0 commit comments