|
1 | | -name: Release - Stable |
2 | | - |
3 | | -on: |
4 | | - release: |
5 | | - types: [published] |
6 | | - |
7 | | -concurrency: |
8 | | - group: ${{ github.workflow }}-${{ github.event.release.id }} |
9 | | - cancel-in-progress: true |
10 | | - |
11 | | -jobs: |
12 | | - test-multiplatform: |
13 | | - name: Test on ${{ matrix.os }} |
14 | | - runs-on: ${{ matrix.os }} |
15 | | - strategy: |
16 | | - matrix: |
17 | | - os: [ubuntu-latest, windows-latest, macos-latest] |
18 | | - permissions: |
19 | | - contents: read |
20 | | - |
21 | | - steps: |
22 | | - - name: Checkout tag |
23 | | - uses: actions/checkout@v4 |
24 | | - with: |
25 | | - fetch-depth: 0 |
26 | | - ref: ${{ github.event.release.tag_name }} |
27 | | - |
28 | | - - name: Setup .NET |
29 | | - uses: actions/setup-dotnet@v4 |
30 | | - with: |
31 | | - dotnet-version: 8.0.x |
32 | | - |
33 | | - - name: Restore dependencies |
34 | | - run: dotnet restore |
35 | | - working-directory: ./src |
36 | | - |
37 | | - - name: Build solution |
38 | | - run: dotnet build -c Release --no-restore |
39 | | - working-directory: ./src |
40 | | - |
41 | | - - name: Run tests |
42 | | - run: dotnet test -c Release --no-build --no-restore --verbosity normal |
43 | | - working-directory: ./src |
44 | | - |
45 | | - publish: |
46 | | - # Only process releases from develop branch |
47 | | - if: github.event.release.target_commitish == 'develop' |
48 | | - runs-on: ubuntu-latest |
49 | | - needs: test-multiplatform |
50 | | - permissions: |
51 | | - contents: read |
52 | | - env: |
53 | | - DOTNET_SKIP_FIRST_TIME_EXPERIENCE: '1' |
54 | | - DOTNET_CLI_TELEMETRY_OPTOUT: '1' |
55 | | - |
56 | | - steps: |
57 | | - - name: Checkout tag |
58 | | - uses: actions/checkout@v4 |
59 | | - with: |
60 | | - fetch-depth: 0 |
61 | | - ref: ${{ github.event.release.tag_name }} |
62 | | - |
63 | | - - name: Setup .NET |
64 | | - uses: actions/setup-dotnet@v4 |
65 | | - with: |
66 | | - dotnet-version: 8.0.x |
67 | | - |
68 | | - - name: Extract and validate release version |
69 | | - run: | |
70 | | - TAG="${{ github.event.release.tag_name }}" |
71 | | - echo "Release tag: $TAG" |
72 | | -
|
73 | | - # Remove 'v' prefix if present |
74 | | - if [[ "$TAG" =~ ^v[0-9] ]]; then |
75 | | - VERSION="${TAG#v}" |
76 | | - else |
77 | | - echo "::error ::Tag must start with 'v' followed by version number (e.g., v1.2.3)" |
78 | | - exit 1 |
79 | | - fi |
80 | | -
|
81 | | - # Validate it's a proper release version (X.Y.Z format, no suffix) |
82 | | - if [[ ! "$VERSION" =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]]; then |
83 | | - echo "::error ::Invalid release version format. Expected X.Y.Z (e.g., 1.2.3), got: $VERSION" |
84 | | - exit 1 |
85 | | - fi |
86 | | -
|
87 | | - echo "Using release version: $VERSION" |
88 | | - echo "RELEASE_VERSION=$VERSION" >> $GITHUB_ENV |
89 | | -
|
90 | | - - name: Restore dependencies |
91 | | - run: dotnet restore |
92 | | - working-directory: ./src |
93 | | - |
94 | | - - name: Build solution (stable) |
95 | | - run: dotnet build -c Release --no-restore -p:Version=${{ env.RELEASE_VERSION }} -p:AssemblyVersion=${{ env.RELEASE_VERSION }} -p:FileVersion=${{ env.RELEASE_VERSION }} |
96 | | - working-directory: ./src |
97 | | - |
98 | | - - name: Pack NuGet packages (stable) |
99 | | - run: dotnet pack -c Release --no-restore /p:IncludeSymbols=true /p:SymbolPackageFormat=snupkg -o ../artifacts -p:Version=${{ env.RELEASE_VERSION }} |
100 | | - working-directory: ./src |
101 | | - |
102 | | - - name: Ensure packages exist |
103 | | - run: | |
104 | | - shopt -s nullglob |
105 | | - files=(artifacts/*.nupkg artifacts/*.snupkg) |
106 | | - (( ${#files[@]} )) || { echo "::error ::No packages found in artifacts/"; exit 1; } |
107 | | -
|
108 | | - - name: Upload artifacts (audit) |
109 | | - uses: actions/upload-artifact@v4 |
110 | | - with: |
111 | | - name: packages-${{ env.RELEASE_VERSION }} |
112 | | - path: artifacts |
113 | | - retention-days: 7 |
114 | | - |
115 | | - - name: Push to NuGet.org |
116 | | - env: |
117 | | - NUGET_API_KEY: ${{ secrets.NUGET_API_KEY }} |
118 | | - run: | |
119 | | - shopt -s nullglob |
120 | | - for p in artifacts/*.nupkg artifacts/*.snupkg; do |
121 | | - dotnet nuget push "$p" --source https://api.nuget.org/v3/index.json --api-key "$NUGET_API_KEY" --skip-duplicate |
122 | | - done |
123 | | -
|
124 | | -
|
| 1 | +name: Release - Stable |
| 2 | + |
| 3 | +on: |
| 4 | + release: |
| 5 | + types: [published] |
| 6 | + |
| 7 | +concurrency: |
| 8 | + group: ${{ github.workflow }}-${{ github.event.release.id }} |
| 9 | + cancel-in-progress: true |
| 10 | + |
| 11 | +jobs: |
| 12 | + validate-version: |
| 13 | + name: Validate & Extract Version |
| 14 | + if: github.event.release.target_commitish == 'develop' |
| 15 | + runs-on: ubuntu-latest |
| 16 | + outputs: |
| 17 | + version: ${{ steps.version.outputs.VERSION }} |
| 18 | + steps: |
| 19 | + - name: Extract and validate release version |
| 20 | + id: version |
| 21 | + run: | |
| 22 | + TAG="${{ github.event.release.tag_name }}" |
| 23 | + echo "Release tag: $TAG" |
| 24 | +
|
| 25 | + if [[ "$TAG" =~ ^v[0-9] ]]; then |
| 26 | + VERSION="${TAG#v}" |
| 27 | + else |
| 28 | + echo "::error ::Tag must start with 'v' followed by version number (e.g., v1.2.3)" |
| 29 | + exit 1 |
| 30 | + fi |
| 31 | +
|
| 32 | + if [[ ! "$VERSION" =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]]; then |
| 33 | + echo "::error ::Invalid release version format. Expected X.Y.Z (e.g., 1.2.3), got: $VERSION" |
| 34 | + exit 1 |
| 35 | + fi |
| 36 | +
|
| 37 | + echo "Using release version: $VERSION" |
| 38 | + echo "VERSION=$VERSION" >> $GITHUB_OUTPUT |
| 39 | +
|
| 40 | + test-multiplatform: |
| 41 | + name: Test on ${{ matrix.os }} |
| 42 | + needs: validate-version |
| 43 | + runs-on: ${{ matrix.os }} |
| 44 | + strategy: |
| 45 | + fail-fast: false |
| 46 | + matrix: |
| 47 | + os: [ubuntu-latest, windows-latest, macos-latest] |
| 48 | + permissions: |
| 49 | + contents: read |
| 50 | + |
| 51 | + steps: |
| 52 | + - name: Checkout tag |
| 53 | + uses: actions/checkout@v4 |
| 54 | + with: |
| 55 | + fetch-depth: 0 |
| 56 | + ref: ${{ github.event.release.tag_name }} |
| 57 | + |
| 58 | + - name: Setup .NET |
| 59 | + uses: actions/setup-dotnet@v4 |
| 60 | + with: |
| 61 | + dotnet-version: 8.0.x |
| 62 | + |
| 63 | + - name: Restore dependencies |
| 64 | + run: dotnet restore |
| 65 | + working-directory: ./src |
| 66 | + |
| 67 | + - name: Build solution |
| 68 | + run: dotnet build -c Release --no-restore |
| 69 | + working-directory: ./src |
| 70 | + |
| 71 | + - name: Run tests |
| 72 | + run: dotnet test -c Release --no-build --no-restore --verbosity normal |
| 73 | + working-directory: ./src |
| 74 | + |
| 75 | + publish: |
| 76 | + name: Pack & Publish to NuGet |
| 77 | + needs: [validate-version, test-multiplatform] |
| 78 | + runs-on: ubuntu-latest |
| 79 | + permissions: |
| 80 | + contents: read |
| 81 | + env: |
| 82 | + DOTNET_SKIP_FIRST_TIME_EXPERIENCE: '1' |
| 83 | + DOTNET_CLI_TELEMETRY_OPTOUT: '1' |
| 84 | + |
| 85 | + steps: |
| 86 | + - name: Checkout tag |
| 87 | + uses: actions/checkout@v4 |
| 88 | + with: |
| 89 | + fetch-depth: 0 |
| 90 | + ref: ${{ github.event.release.tag_name }} |
| 91 | + |
| 92 | + - name: Setup .NET |
| 93 | + uses: actions/setup-dotnet@v4 |
| 94 | + with: |
| 95 | + dotnet-version: 8.0.x |
| 96 | + |
| 97 | + - name: Restore dependencies |
| 98 | + run: dotnet restore |
| 99 | + working-directory: ./src |
| 100 | + |
| 101 | + - name: Build solution (stable) |
| 102 | + run: dotnet build -c Release --no-restore -p:Version=${{ needs.validate-version.outputs.version }} |
| 103 | + working-directory: ./src |
| 104 | + |
| 105 | + - name: Pack NuGet packages (stable) |
| 106 | + run: dotnet pack -c Release --no-restore -p:IncludeSymbols=true -p:SymbolPackageFormat=snupkg -o ../artifacts -p:Version=${{ needs.validate-version.outputs.version }} |
| 107 | + working-directory: ./src |
| 108 | + |
| 109 | + - name: Ensure packages exist |
| 110 | + run: | |
| 111 | + shopt -s nullglob |
| 112 | + files=(artifacts/*.nupkg artifacts/*.snupkg) |
| 113 | + (( ${#files[@]} )) || { echo "::error ::No packages found in artifacts/"; exit 1; } |
| 114 | +
|
| 115 | + - name: Upload artifacts (audit) |
| 116 | + uses: actions/upload-artifact@v4 |
| 117 | + with: |
| 118 | + name: packages-${{ needs.validate-version.outputs.version }} |
| 119 | + path: artifacts |
| 120 | + retention-days: 7 |
| 121 | + |
| 122 | + - name: Push to NuGet.org |
| 123 | + env: |
| 124 | + NUGET_API_KEY: ${{ secrets.NUGET_API_KEY }} |
| 125 | + run: | |
| 126 | + shopt -s nullglob |
| 127 | + for p in artifacts/*.nupkg artifacts/*.snupkg; do |
| 128 | + dotnet nuget push "$p" --source https://api.nuget.org/v3/index.json --api-key "$NUGET_API_KEY" --skip-duplicate |
| 129 | + done |
| 130 | +
|
| 131 | + deploy-docs: |
| 132 | + name: Deploy Documentation |
| 133 | + needs: [validate-version, publish] |
| 134 | + runs-on: ubuntu-latest |
| 135 | + permissions: |
| 136 | + contents: read |
| 137 | + |
| 138 | + steps: |
| 139 | + - name: Checkout tag |
| 140 | + uses: actions/checkout@v4 |
| 141 | + with: |
| 142 | + ref: ${{ github.event.release.tag_name }} |
| 143 | + |
| 144 | + - name: Setup Node.js |
| 145 | + uses: actions/setup-node@v4 |
| 146 | + with: |
| 147 | + node-version: 22 |
| 148 | + |
| 149 | + - name: Install dependencies |
| 150 | + working-directory: website |
| 151 | + run: npm ci |
| 152 | + |
| 153 | + - name: Build VitePress |
| 154 | + working-directory: website |
| 155 | + run: npx vitepress build |
| 156 | + |
| 157 | + - name: Extract docs version |
| 158 | + id: docs-version |
| 159 | + env: |
| 160 | + VERSION: ${{ needs.validate-version.outputs.version }} |
| 161 | + run: | |
| 162 | + MAJOR=$(echo "$VERSION" | cut -d. -f1) |
| 163 | + MINOR=$(echo "$VERSION" | cut -d. -f2) |
| 164 | + echo "value=v${MAJOR}.${MINOR}" >> $GITHUB_OUTPUT |
| 165 | +
|
| 166 | + - name: Package |
| 167 | + run: cd website/.vitepress/dist && zip -r $GITHUB_WORKSPACE/docs.zip . |
| 168 | + |
| 169 | + - name: Upload to Shelf |
| 170 | + env: |
| 171 | + KEY: ${{ secrets.SHELF_API_KEY }} |
| 172 | + URL: ${{ secrets.SHELF_BASE_URL }} |
| 173 | + VER: ${{ steps.docs-version.outputs.value }} |
| 174 | + run: | |
| 175 | + echo "Deploying filesystem docs $VER to $URL" |
| 176 | + curl -f -X POST \ |
| 177 | + -H "Authorization: Bearer $KEY" \ |
| 178 | + -H "Content-Type: application/zip" \ |
| 179 | + --data-binary @$GITHUB_WORKSPACE/docs.zip \ |
| 180 | + "${URL}/api/products/filesystem/versions/${VER}" |
| 181 | +
|
| 182 | + - name: Docs deployment summary |
| 183 | + run: | |
| 184 | + echo "### Documentation Deployed" >> $GITHUB_STEP_SUMMARY |
| 185 | + echo "" >> $GITHUB_STEP_SUMMARY |
| 186 | + echo "**Product:** filesystem" >> $GITHUB_STEP_SUMMARY |
| 187 | + echo "**Version:** ${{ steps.docs-version.outputs.value }}" >> $GITHUB_STEP_SUMMARY |
| 188 | + echo "**URL:** ${{ secrets.SHELF_BASE_URL }}/filesystem/" >> $GITHUB_STEP_SUMMARY |
0 commit comments