Skip to content

Commit 0126550

Browse files
committed
doc updates
1 parent 5558422 commit 0126550

2 files changed

Lines changed: 60 additions & 51 deletions

File tree

PUBLISHING.md

Lines changed: 60 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -32,81 +32,90 @@ SchemaMagic uses **Nerdbank.GitVersioning (nbgv)** for automatic version managem
3232

3333
## Publishing Methods
3434

35-
### Method 1: Automated Publishing via GitHub Actions (Recommended)
35+
### Method 1: Automated Publishing Script (Recommended)
3636

37-
The CI/CD pipeline automatically handles everything when you push a version tag.
37+
The `Publish.ps1` script automates the entire release process by creating and pushing a Git tag, which triggers the CI/CD pipeline.
3838

39-
#### Setup GitHub Secrets
39+
#### Quick Publish
4040

41-
1. Go to repository **Settings ? Secrets and variables ? Actions**
42-
2. Add a new secret named `NUGET_API_KEY`
43-
3. Paste your NuGet API key as the value
44-
45-
#### Trigger Automated Publishing
46-
47-
```bash
48-
# Make your changes
41+
```powershell
42+
# 1. Commit all your changes
4943
git add .
50-
git commit -m "Add new feature"
44+
git commit -m "Your changes"
5145
git push origin main
5246
53-
# Create and push a version tag
54-
git tag -a v1.0.42 -m "Release version 1.0.42"
55-
git push origin v1.0.42
47+
# 2. Run publish script (creates tag, pushes it, triggers CI/CD)
48+
.\Publish.ps1
5649
```
5750

5851
**What happens automatically:**
59-
1. ? Tests run
60-
2. ? NuGet package built with nbgv version
61-
3. ? Package published to NuGet.org
62-
4. ? GitHub Release created with install instructions
63-
5. ? Web application deployed to GitHub Pages
64-
6. ? Deployment summary added to Actions run
65-
66-
**GitHub Actions Workflow:**
67-
- Trigger: Push tags matching `v*` (e.g., v1.0.42)
68-
- File: `.github/workflows/ci-cd.yml`
69-
- Jobs:
70-
- `test`: Run tests
71-
- `publish-nuget`: Build and publish NuGet package (only on tag push)
72-
- `deploy-web`: Deploy Blazor WebAssembly app to GitHub Pages
52+
1. ? Version calculated from git history using nbgv (e.g., 1.0.42)
53+
2. ? NuGet package built locally
54+
3. ? Git tag created (e.g., v1.0.42)
55+
4. ? **Tag pushed to GitHub (triggers CI/CD pipeline)**
56+
5. ? CI/CD runs tests
57+
6. ? CI/CD publishes to NuGet.org
58+
7. ? CI/CD creates GitHub Release
59+
8. ? CI/CD deploys web application to GitHub Pages
7360

74-
### Method 2: Manual Publishing with Publish.ps1
75-
76-
For local testing or manual control over the publishing process.
77-
78-
#### Test Build Only
61+
#### Dry Run (Test Without Changes)
7962

8063
```powershell
81-
.\Publish.ps1
64+
.\Publish.ps1 -DryRun
8265
```
8366

84-
This will:
85-
- ? Calculate version from git history (e.g., 1.0.42)
86-
- ? Build the NuGet package
87-
- ? Create git tag locally (e.g., v1.0.42)
88-
- ? Display package location for manual testing
89-
90-
#### Full Publish to NuGet
67+
#### Manual NuGet Publish (Emergency Only)
9168

9269
```powershell
70+
# This will ALSO trigger CI/CD (which will also publish)
71+
# Only use if CI/CD is broken and you need immediate hotfix
9372
.\Publish.ps1 -PublishToNuGet -ApiKey "YOUR_NUGET_API_KEY"
9473
```
9574

96-
Or using environment variable:
75+
### Method 2: Manual Git Tag (Alternative)
9776

98-
```powershell
99-
$env:NUGET_API_KEY = "YOUR_NUGET_API_KEY"
100-
.\Publish.ps1 -PublishToNuGet
101-
```
77+
You can also manually create and push tags to trigger CI/CD:
10278

103-
#### Dry Run (Test Without Changes)
79+
```bash
80+
# Get current version
81+
dotnet tool install -g nbgv
82+
$version = nbgv get-version -v SimpleVersion
10483

105-
```powershell
106-
.\Publish.ps1 -DryRun -PublishToNuGet
84+
# Create and push tag
85+
git tag -a "v$version" -m "Release version $version"
86+
git push origin "v$version"
10787
```
10888

109-
**Note:** Manual publishing doesn't automatically deploy to GitHub Pages. Use GitHub Actions or manually trigger the `deploy-web.yml` workflow.
89+
**What happens automatically:**
90+
1. ? GitHub Actions CI/CD pipeline triggered
91+
2. ? Tests run
92+
3. ? NuGet package published
93+
4. ? GitHub Release created
94+
5. ? Web application deployed
95+
96+
## CI/CD Pipeline Configuration
97+
98+
### Trigger Rules
99+
100+
The CI/CD pipeline (`.github/workflows/ci-cd.yml`) **only** triggers on:
101+
102+
1. **Version tags** (`v*`) - e.g., `v1.0.42`, `v2.1.0`
103+
2. **Manual workflow dispatch** (via GitHub Actions UI)
104+
105+
**Important:** The pipeline does **NOT** trigger on:
106+
- ❌ Regular pushes to `main` or `develop`
107+
- ❌ Pull requests
108+
- ❌ Branch updates
109+
110+
This prevents unnecessary builds and ensures releases are intentional.
111+
112+
### Setup GitHub Secrets
113+
114+
For CI/CD to work, configure the NuGet API key:
115+
116+
1. Go to repository **Settings → Secrets and variables → Actions**
117+
2. Add a new secret named `NUGET_API_KEY`
118+
3. Paste your NuGet API key as the value
110119

111120
## Version Bumping
112121

PUBLISHING_WORKFLOW.md

Whitespace-only changes.

0 commit comments

Comments
 (0)