-
-
Notifications
You must be signed in to change notification settings - Fork 24
158 lines (142 loc) · 6.94 KB
/
release.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
# 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/checkout@v3
- uses: actions/setup-dotnet@v3
with:
dotnet-version: '6.0.x'
# For the following tests
- name: Install protocol buffers compiler
run: |
wget -O protoc.zip https://github.com/protocolbuffers/protobuf/releases/download/v3.15.8/protoc-3.15.8-linux-x86_64.zip
unzip protoc.zip -d $HOME/.local
export PATH="$PATH:$HOME/.local/bin"
# The tests should have already been run during the PR workflow, so this is really just a sanity check
# See issue #285 for info why the symlink is necessary.
- name: SnapshooterHotfixSymlinkLinux
run: sudo ln -s "$GITHUB_WORKSPACE" /_
shell: bash
- 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 pack --configuration Release /p:Version=$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.Core.${{ steps.package_release.outputs.version }}.nupkg
dotnet nuget push --source https://api.nuget.org/v3/index.json --api-key "$NUGET_API_KEY" ./nupkgs/CycloneDX.Utils.${{ steps.package_release.outputs.version }}.nupkg
dotnet nuget push --source https://api.nuget.org/v3/index.json --api-key "$NUGET_API_KEY" ./nupkgs/CycloneDX.Spdx.${{ steps.package_release.outputs.version }}.nupkg
dotnet nuget push --source https://api.nuget.org/v3/index.json --api-key "$NUGET_API_KEY" ./nupkgs/CycloneDX.Spdx.Interop.${{ steps.package_release.outputs.version }}.nupkg
- name: Create github release and git tag for release
id: create_release
uses: actions/[email protected]
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.Core.${{ steps.package_release.outputs.version }}.nupkg
asset_name: CycloneDX.Core.${{ 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.Core.${{ steps.package_release.outputs.version }}.snupkg
asset_name: CycloneDX.Core.${{ steps.package_release.outputs.version }}.snupkg
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.Utils.${{ steps.package_release.outputs.version }}.nupkg
asset_name: CycloneDX.Utils.${{ 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.Utils.${{ steps.package_release.outputs.version }}.snupkg
asset_name: CycloneDX.Utils.${{ steps.package_release.outputs.version }}.snupkg
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.Spdx.${{ steps.package_release.outputs.version }}.nupkg
asset_name: CycloneDX.Spdx.${{ 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.Spdx.${{ steps.package_release.outputs.version }}.snupkg
asset_name: CycloneDX.Spdx.${{ steps.package_release.outputs.version }}.snupkg
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.Spdx.Interop.${{ steps.package_release.outputs.version }}.nupkg
asset_name: CycloneDX.Spdx.Interop.${{ 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.Spdx.Interop.${{ steps.package_release.outputs.version }}.snupkg
asset_name: CycloneDX.Spdx.Interop.${{ steps.package_release.outputs.version }}.snupkg
asset_content_type: application/zip