mirror of
https://github.com/adamhathcock/sharpcompress.git
synced 2026-02-04 05:25:00 +00:00
Remove GitHub release creation - will be done manually
- Removed create-release build target from build/Program.cs - Removed CreateRelease constant - Removed "Create GitHub Release" step from workflow - Removed permissions: contents: write since no longer creating releases - Updated NUGET_RELEASE.md to remove all references to GitHub release creation - Updated TESTING.md to remove GitHub release verification steps - GitHub releases will now be created manually instead of automatically Co-authored-by: adamhathcock <527620+adamhathcock@users.noreply.github.com>
This commit is contained in:
7
.github/workflows/NUGET_RELEASE.md
vendored
7
.github/workflows/NUGET_RELEASE.md
vendored
@@ -16,7 +16,6 @@ The workflow automatically determines the version based on whether the commit is
|
||||
- If the current commit has a version tag (e.g., `0.42.1`)
|
||||
- Uses the tag as the version number
|
||||
- Published as a stable release
|
||||
- Creates a GitHub Release with the package attached (Windows build only)
|
||||
|
||||
2. **Untagged Release (Prerelease)**:
|
||||
- If the current commit is NOT tagged
|
||||
@@ -36,7 +35,6 @@ The workflow runs on a matrix of operating systems (Windows and Ubuntu):
|
||||
5. **Build and Test**: Runs the full build and test suite on both platforms
|
||||
6. **Upload Artifacts**: Uploads the generated `.nupkg` files as workflow artifacts (separate for each OS)
|
||||
7. **Push to NuGet**: (Windows only) Runs `push-to-nuget` build target to publish the package to NuGet.org using the API key
|
||||
8. **Create GitHub Release**: (Windows only, tagged releases only) Runs `create-release` build target to create a GitHub release with the package
|
||||
|
||||
All version detection, file updates, and publishing logic is implemented in C# in the `build/Program.cs` file using build targets.
|
||||
|
||||
@@ -72,7 +70,6 @@ Consider enabling branch protection rules for the `release` branch to ensure:
|
||||
3. The workflow will automatically:
|
||||
- Build and test the project on both Windows and Ubuntu
|
||||
- Publish `SharpCompress 0.43.0` to NuGet.org (Windows build)
|
||||
- Create a GitHub Release (Windows build)
|
||||
|
||||
### Creating a Prerelease
|
||||
|
||||
@@ -122,7 +119,6 @@ The workflow uses the following C# build targets defined in `build/Program.cs`:
|
||||
- **determine-version**: Detects version from git tags and outputs VERSION and PRERELEASE variables
|
||||
- **update-version**: Updates VersionPrefix, AssemblyVersion, and FileVersion in the project file
|
||||
- **push-to-nuget**: Pushes the generated NuGet packages to NuGet.org (requires NUGET_API_KEY)
|
||||
- **create-release**: Creates a GitHub release with the packages attached (requires GITHUB_TOKEN)
|
||||
|
||||
These targets can be run manually for testing:
|
||||
|
||||
@@ -135,9 +131,6 @@ VERSION=0.43.0 dotnet run --project build/build.csproj -- update-version
|
||||
|
||||
# Push to NuGet (requires NUGET_API_KEY environment variable)
|
||||
NUGET_API_KEY=your-key dotnet run --project build/build.csproj -- push-to-nuget
|
||||
|
||||
# Create GitHub release (requires GITHUB_TOKEN and VERSION environment variables)
|
||||
GITHUB_TOKEN=your-token VERSION=0.43.0 PRERELEASE=false dotnet run --project build/build.csproj -- create-release
|
||||
```
|
||||
|
||||
## Related Files
|
||||
|
||||
14
.github/workflows/TESTING.md
vendored
14
.github/workflows/TESTING.md
vendored
@@ -30,7 +30,6 @@ This tests the workflow on untagged commits to the master or release branch.
|
||||
- Build and tests pass on both platforms
|
||||
- Package artifacts are uploaded for both platforms
|
||||
- Package is pushed to NuGet.org as prerelease (Windows build only)
|
||||
- No GitHub release is created (only for tagged releases)
|
||||
|
||||
**Expected Outcome:**
|
||||
- A new prerelease package appears on NuGet.org: https://www.nuget.org/packages/SharpCompress/
|
||||
@@ -55,12 +54,10 @@ This tests the workflow when a version tag is pushed.
|
||||
- Build and tests pass on both platforms
|
||||
- Package artifacts are uploaded for both platforms
|
||||
- Package is pushed to NuGet.org as stable release (Windows build only)
|
||||
- GitHub release is created with the package attached (Windows build only)
|
||||
|
||||
**Expected Outcome:**
|
||||
- A new stable release package appears on NuGet.org
|
||||
- Package version matches the tag
|
||||
- A GitHub release is created: https://github.com/adamhathcock/sharpcompress/releases
|
||||
|
||||
### 3. Test Duplicate Package Handling
|
||||
|
||||
@@ -92,8 +89,7 @@ After each test, verify:
|
||||
|
||||
1. **GitHub Actions Logs**: Check the workflow logs for any errors or warnings
|
||||
2. **NuGet.org**: Verify the package appears with correct version and metadata
|
||||
3. **GitHub Releases**: (For tagged releases) Verify the release is created with package attached
|
||||
4. **Artifacts**: Download and inspect the uploaded artifacts
|
||||
3. **Artifacts**: Download and inspect the uploaded artifacts
|
||||
|
||||
## Rollback/Cleanup
|
||||
|
||||
@@ -101,11 +97,10 @@ If testing produces unwanted packages:
|
||||
|
||||
1. **Prerelease packages**: Can be unlisted on NuGet.org (Settings → Unlist)
|
||||
2. **Stable packages**: Cannot be deleted, only unlisted (use test versions)
|
||||
3. **GitHub Releases**: Can be deleted from GitHub releases page
|
||||
4. **Tags**: Can be deleted with:
|
||||
3. **Tags**: Can be deleted with:
|
||||
```bash
|
||||
git tag -d 0.42.2-test
|
||||
git push origin :refs/tags/0.42.2-test
|
||||
git tag -d 0.42.2
|
||||
git push origin :refs/tags/0.42.2
|
||||
```
|
||||
|
||||
## Known Limitations
|
||||
@@ -120,7 +115,6 @@ The workflow is considered successful if:
|
||||
|
||||
- ✅ Prerelease versions are published correctly with beta suffix
|
||||
- ✅ Tagged versions are published as stable releases
|
||||
- ✅ GitHub releases are created for tagged versions
|
||||
- ✅ Build and test failures prevent publishing
|
||||
- ✅ Duplicate packages are handled gracefully
|
||||
- ✅ Workflow logs are clear and informative
|
||||
|
||||
12
.github/workflows/nuget-release.yml
vendored
12
.github/workflows/nuget-release.yml
vendored
@@ -9,8 +9,6 @@ on:
|
||||
jobs:
|
||||
build-and-publish:
|
||||
runs-on: ${{ matrix.os }}
|
||||
permissions:
|
||||
contents: write
|
||||
strategy:
|
||||
matrix:
|
||||
os: [windows-latest, ubuntu-latest]
|
||||
@@ -52,13 +50,3 @@ jobs:
|
||||
run: dotnet run --project build/build.csproj -- push-to-nuget
|
||||
env:
|
||||
NUGET_API_KEY: ${{ secrets.NUGET_API_KEY }}
|
||||
|
||||
# Create GitHub release for tagged versions using C# build target (Windows only)
|
||||
- name: Create GitHub Release
|
||||
if: steps.version.outputs.prerelease == 'false' && success() && matrix.os == 'windows-latest'
|
||||
run: dotnet run --project build/build.csproj -- create-release
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
VERSION: ${{ steps.version.outputs.version }}
|
||||
PRERELEASE: ${{ steps.version.outputs.prerelease }}
|
||||
GITHUB_REPOSITORY: ${{ github.repository }}
|
||||
|
||||
@@ -19,7 +19,6 @@ const string Publish = "publish";
|
||||
const string DetermineVersion = "determine-version";
|
||||
const string UpdateVersion = "update-version";
|
||||
const string PushToNuGet = "push-to-nuget";
|
||||
const string CreateRelease = "create-release";
|
||||
|
||||
Target(
|
||||
Clean,
|
||||
@@ -211,56 +210,6 @@ Target(
|
||||
}
|
||||
);
|
||||
|
||||
Target(
|
||||
CreateRelease,
|
||||
async () =>
|
||||
{
|
||||
var version = Environment.GetEnvironmentVariable("VERSION");
|
||||
var isPrerelease = Environment.GetEnvironmentVariable("PRERELEASE");
|
||||
var githubToken = Environment.GetEnvironmentVariable("GITHUB_TOKEN");
|
||||
var githubRepository = Environment.GetEnvironmentVariable("GITHUB_REPOSITORY");
|
||||
|
||||
if (string.IsNullOrEmpty(version))
|
||||
{
|
||||
var (detectedVersion, _) = await GetVersion();
|
||||
version = detectedVersion;
|
||||
}
|
||||
|
||||
if (isPrerelease == "true")
|
||||
{
|
||||
Console.WriteLine("Skipping GitHub release creation for prerelease version.");
|
||||
return;
|
||||
}
|
||||
|
||||
if (string.IsNullOrEmpty(githubToken))
|
||||
{
|
||||
Console.WriteLine(
|
||||
"GITHUB_TOKEN environment variable is not set. Skipping GitHub release creation."
|
||||
);
|
||||
return;
|
||||
}
|
||||
|
||||
var packages = Directory.GetFiles("artifacts", "*.nupkg");
|
||||
var packageArgs = string.Join(" ", packages.Select(p => $"\"{p}\""));
|
||||
|
||||
var repo = string.IsNullOrEmpty(githubRepository) ? "" : $"--repo {githubRepository}";
|
||||
|
||||
Console.WriteLine($"Creating GitHub release for version {version}");
|
||||
try
|
||||
{
|
||||
Run(
|
||||
"gh",
|
||||
$"release create \"{version}\" {packageArgs} --title \"Release {version}\" --notes \"Release {version} of SharpCompress\" {repo}"
|
||||
);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Console.WriteLine($"Failed to create GitHub release: {ex.Message}");
|
||||
throw;
|
||||
}
|
||||
}
|
||||
);
|
||||
|
||||
Target("default", [Publish], () => Console.WriteLine("Done!"));
|
||||
|
||||
await RunTargetsAndExitAsync(args);
|
||||
|
||||
Reference in New Issue
Block a user