-
-
Notifications
You must be signed in to change notification settings - Fork 24
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add packaging to project files and release workflow
- Loading branch information
1 parent
7bd1c8b
commit 965b966
Showing
6 changed files
with
134 additions
and
151 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,93 @@ | ||
# This workflow is used for publishing the NuGet packages. | ||
# | ||
# Before triggering a release the `semver.txt` file should be updated in the | ||
# relevant branch. | ||
# | ||
# When commiting the version change in `semver.txt` the commit message is | ||
# important as it will be used for the release in GitHub. | ||
# | ||
# For an example commit browse to | ||
# https://github.com/CycloneDX/cyclonedx-dotnet/commit/d110af854371374460430bb8438225a7d7a84274. | ||
# | ||
# The resulting release is here | ||
# https://github.com/CycloneDX/cyclonedx-dotnet/releases/tag/v1.0.0. | ||
# | ||
# Releases are triggered manually. This can be done by browsing to | ||
# https://github.com/CycloneDX/cyclonedx-dotnet-library/actions?query=workflow%3ARelease | ||
# and selecting "Run workflow". If releasing a patch for a previous version | ||
# make sure the correct branch is selected. It will default to the default | ||
# branch. | ||
name: Release | ||
|
||
on: | ||
workflow_dispatch | ||
|
||
jobs: | ||
release: | ||
name: Release | ||
runs-on: ubuntu-latest | ||
timeout-minutes: 30 | ||
steps: | ||
- uses: actions/[email protected] | ||
|
||
# The tests should have already been run during the PR workflow, so this is really just a sanity check | ||
- name: Tests | ||
run: dotnet test | ||
|
||
# Build and package everything | ||
- name: Package release | ||
id: package_release | ||
run: | | ||
VERSION=`cat semver.txt` | ||
echo "##[set-output name=version;]$VERSION" | ||
dotnet build --configuration Release | ||
dotnet pack --configuration Release --version-suffix $VERSION --output ./nupkgs | ||
- name: Publish packages to NuGet | ||
env: | ||
NUGET_API_KEY: ${{ secrets.NUGET_API_KEY }} | ||
run: | | ||
dotnet nuget push --source https://api.nuget.org/v3/index.json --api-key "$NUGET_API_KEY" ./nupkgs/CycloneDX.Models.${{ steps.package_release.outputs.version }}.nupkg | ||
dotnet nuget push --source https://api.nuget.org/v3/index.json --api-key "$NUGET_API_KEY" ./nupkgs/CycloneDX.Json.${{ steps.package_release.outputs.version }}.nupkg | ||
dotnet nuget push --source https://api.nuget.org/v3/index.json --api-key "$NUGET_API_KEY" ./nupkgs/CycloneDX.Xml.${{ steps.package_release.outputs.version }}.nupkg | ||
- name: Create github release and git tag for release | ||
id: create_release | ||
uses: actions/create-release@v1 | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
with: | ||
release_name: ${{ steps.package_release.outputs.version }} | ||
tag_name: v${{ steps.package_release.outputs.version }} | ||
draft: false | ||
prerelease: false | ||
|
||
- name: Upload package to github release | ||
uses: actions/upload-release-asset@v1 | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
with: | ||
upload_url: ${{ steps.create_release.outputs.upload_url }} | ||
asset_path: ./nupkgs/CycloneDX.Models.${{ steps.package_release.outputs.version }}.nupkg | ||
asset_name: CycloneDX.Models.${{ steps.package_release.outputs.version }}.nupkg | ||
asset_content_type: application/zip | ||
|
||
- name: Upload package to github release | ||
uses: actions/upload-release-asset@v1 | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
with: | ||
upload_url: ${{ steps.create_release.outputs.upload_url }} | ||
asset_path: ./nupkgs/CycloneDX.Json.${{ steps.package_release.outputs.version }}.nupkg | ||
asset_name: CycloneDX.Json.${{ steps.package_release.outputs.version }}.nupkg | ||
asset_content_type: application/zip | ||
|
||
- name: Upload package to github release | ||
uses: actions/upload-release-asset@v1 | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
with: | ||
upload_url: ${{ steps.create_release.outputs.upload_url }} | ||
asset_path: ./nupkgs/CycloneDX.Xml.${{ steps.package_release.outputs.version }}.nupkg | ||
asset_name: CycloneDX.Xml.${{ steps.package_release.outputs.version }}.nupkg | ||
asset_content_type: application/zip |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,7 +2,7 @@ | |
/.vscode/ | ||
bin/ | ||
obj/ | ||
packages/ | ||
nupkgs/ | ||
coverage-report/ | ||
coverage.cobertura.xml | ||
*/__snapshots__/__mismatch__/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,21 @@ | ||
<Project Sdk="Microsoft.NET.Sdk"> | ||
|
||
<ItemGroup> | ||
<ProjectReference Include="..\CycloneDX.Models\CycloneDX.Models.csproj" /> | ||
</ItemGroup> | ||
|
||
<PropertyGroup> | ||
<TargetFramework>netstandard2.0</TargetFramework> | ||
<Product>CycloneDX.Xml</Product> | ||
<Authors>Steve Springett</Authors> | ||
<Copyright>Copyright (c) Steve Springett</Copyright> | ||
<Description>A .NET Standard library for serializing and deserializing XML format CycloneDX bill-of-material documents.</Description> | ||
<PackageId>CycloneDX.Xml</PackageId> | ||
<PackageLicenseExpression>Apache-2.0</PackageLicenseExpression> | ||
<PackageProjectUrl>https://github.com/CycloneDX/cyclonedx-dotnet-library</PackageProjectUrl> | ||
<PackageVersion>$(VersionSuffix)</PackageVersion> | ||
<RepositoryType>git</RepositoryType> | ||
<RepositoryUrl>https://github.com/CycloneDX/cyclonedx-dotnet-library.git</RepositoryUrl> | ||
</PropertyGroup> | ||
|
||
<ItemGroup> | ||
<ProjectReference Include="..\CycloneDX.Models\CycloneDX.Models.csproj" /> | ||
</ItemGroup> | ||
|
||
</Project> |