microsoft/hve-core

Public

mirrored from https://github.com/microsoft/hve-coreAvailable

CodeCommitsIssuesPull requestsActionsInsightsSecurity
docs/design-thinking-documentation

Branches

Tags

  • No tags available.
0Branches0Tags
Go to file
Add file
Code

Clone

HTTPS

Download ZIP

.github/workflows/extension-publish-prerelease.yml

101lines · modecode

1name: Publish Pre-Release Extension
2
3on:
4 workflow_dispatch:
5 inputs:
6 version:
7 description: "ODD minor version (e.g., 1.1.0). Leave empty to auto-detect from latest release."
8 required: false
9 type: string
10 default: ""
11 dry-run:
12 description: "Dry run (package only, do not publish)"
13 required: false
14 type: boolean
15 default: false
16
17permissions:
18 contents: read
19
20concurrency:
21 group: ${{ github.workflow }}-${{ github.ref }}
22 cancel-in-progress: false
23
24jobs:
25 validate-version:
26 name: Validate Pre-Release Version
27 runs-on: ubuntu-latest
28 permissions: {}
29 outputs:
30 version: ${{ steps.validate.outputs.version }}
31 steps:
32 - name: Validate ODD minor version
33 id: validate
34 env:
35 GH_TOKEN: ${{ github.token }}
36 INPUT_VERSION: ${{ inputs.version }}
37 run: |
38 VERSION="$INPUT_VERSION"
39 # Strip leading 'v' or 'hve-core-v' prefix if present
40 VERSION="${VERSION#v}"
41 VERSION="${VERSION#hve-core-v}"
42
43 # Auto-detect from latest release tag when no version specified
44 if [ -z "$VERSION" ]; then
45 TAG=$(gh release view --json tagName -q '.tagName' -R "${{ github.repository }}")
46 VERSION="${TAG#hve-core-v}"
47
48 MAJOR=$(echo "$VERSION" | cut -d. -f1)
49 MINOR=$(echo "$VERSION" | cut -d. -f2)
50 PATCH=$(echo "$VERSION" | cut -d. -f3)
51
52 # Derive ODD minor: if even, bump minor by 1 and reset patch
53 if (( MINOR % 2 == 0 )); then
54 MINOR=$((MINOR + 1))
55 PATCH=0
56 fi
57 VERSION="${MAJOR}.${MINOR}.${PATCH}"
58 echo "📦 Auto-derived pre-release version from latest release: $VERSION"
59 fi
60
61 # Validate format
62 if ! [[ "$VERSION" =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
63 echo "::error::Invalid version format: $VERSION. Expected semantic version (e.g., 1.1.0)"
64 exit 1
65 fi
66
67 # Extract minor version
68 MINOR=$(echo "$VERSION" | cut -d. -f2)
69
70 # Check if ODD (pre-release channel uses ODD minor versions)
71 if (( MINOR % 2 == 0 )); then
72 echo "::error::Pre-release requires ODD minor version. Got: $VERSION (minor=$MINOR is EVEN)"
73 echo "::error::Use version like 1.1.0, 1.3.0, 2.1.0 for pre-release channel"
74 exit 1
75 fi
76
77 echo "✅ Valid pre-release version: $VERSION (minor=$MINOR is ODD)"
78 echo "version=$VERSION" >> "$GITHUB_OUTPUT"
79
80 package:
81 name: Package Pre-Release Extensions
82 needs: validate-version
83 uses: ./.github/workflows/extension-package.yml
84 with:
85 version: ${{ needs.validate-version.outputs.version }}
86 channel: PreRelease
87 permissions:
88 contents: read
89
90 publish:
91 name: Publish Pre-Release Extensions
92 needs: [package]
93 if: ${{ !inputs.dry-run }}
94 uses: ./.github/workflows/extension-publish-marketplace.yml
95 with:
96 collections-matrix: ${{ needs.package.outputs.collections-matrix }}
97 pre-release: true
98 permissions:
99 contents: read
100 id-token: write
101 secrets: inherit
102