You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
# This job builds and publishes the package to NuGet.
3
3
# It depends on the included tests job to complete successfully.
4
-
#The version number is determined by the existing tag provided
5
-
#when manually triggering the workflow.
6
-
#The tag is not limited to a certain branch.
4
+
#This workflow finds the most recent tag that starts with
5
+
#the selected major version (sorted by creatordate)
6
+
#and runs the test, build and publish tasks for that tag.
7
7
on:
8
8
workflow_dispatch:
9
-
inputs:
10
-
version_tag:
11
-
description: 'Enter an existing version tag to publish (e.g., "v5.1.0" or "v6.0.0-pre.1")'
12
-
required: true
13
-
type: string
14
-
9
+
inputs:
10
+
major_version:
11
+
description: 'Select the major version to publish (tag prefix). The workflow will pick the most recent tag that starts with this value (e.g. v3 -> v3.2.1).'
12
+
required: true
13
+
type: choice
14
+
options:
15
+
- v3
16
+
# - v4
15
17
jobs:
16
18
tests:
17
-
runs-on: ubuntu-22.04
18
-
# ubuntu-latest = ubuntu-24.04 does not include mono needed for tests (2025-08-01)
19
+
runs-on: ubuntu-22.04 # ubuntu-24.04 does not include mono needed for net4x tests
19
20
outputs:
20
-
VERSION: ${{ steps.set_version.outputs.VERSION }}
21
+
VERSION: ${{ steps.resolve.outputs.VERSION }}
22
+
TAG_NAME: ${{ steps.resolve.outputs.TAG_NAME }}
21
23
steps:
22
24
- name: Checkout repository
23
25
uses: actions/checkout@v5
24
26
with:
25
27
fetch-depth: 0# Fetch all history for all tags and branches
26
28
27
-
- name: Verify tag exists
28
-
run: |
29
-
git fetch --tags --quiet
30
-
if ! git rev-parse "${{ inputs.version_tag }}" >/dev/null 2>&1; then
31
-
echo "::error::Tag '${{ inputs.version_tag }}' does not exist."
32
-
echo "Available tags:"
33
-
git tag -l
34
-
exit 1
35
-
fi
36
-
37
-
- name: Checkout tag
38
-
uses: actions/checkout@v5
39
-
with:
40
-
fetch-depth: 0# Fetch all history for all tags and branches
41
-
ref: ${{ inputs.version_tag }}
42
-
43
-
- name: Set VERSION output
44
-
id: set_version
29
+
- name: Show matching major version tags and select latest by creatordate
30
+
id: resolve
31
+
shell: bash
45
32
run: |
46
-
Version="${{ inputs.version_tag }}"
47
-
# Strip 'v' prefix for VERSION variable
48
-
Version="${Version#v}"
49
-
echo "VERSION=$Version" >> $GITHUB_ENV
50
-
echo "VERSION=$Version" >> $GITHUB_OUTPUT
51
-
echo "Version: $Version"
33
+
set -euo pipefail
34
+
# Call the script to resolve the latest tag for the requested major version.
35
+
# Script writes TAG_NAME and VERSION to $GITHUB_OUTPUT and $GITHUB_ENV when run on Actions.
0 commit comments