@halospv3/hce.shared-config 2.0.0 → 2.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +15 -0
- package/README.md +120 -55
- package/dotnet/.github/workflows/_unit_test.yml +34 -0
- package/dotnet/.github/workflows/ci.yml +22 -0
- package/dotnet/.github/workflows/dotnet-release.yml +20 -45
- package/dotnet/.releaserc.cjs +77 -0
- package/dotnet/ZipPublishDir.targets +11 -5
- package/package.json +3 -2
- package/static/.releaserc.yml +9 -5
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,18 @@
|
|
|
1
|
+
## [2.1.0](https://github.com/halospv3/hce.shared/compare/v2.0.1...v2.1.0) (2024-03-18)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Features
|
|
5
|
+
|
|
6
|
+
* add plugin '@semantic-release/exec' ([61447fc](https://github.com/halospv3/hce.shared/commit/61447fcdef19db8cd7f103edd54354fa5c4cb202))
|
|
7
|
+
|
|
8
|
+
## [2.0.1](https://github.com/halospv3/hce.shared/compare/v2.0.0...v2.0.1) (2024-03-18)
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
### Bug Fixes
|
|
12
|
+
|
|
13
|
+
* **deps:** update dependency @semantic-release/commit-analyzer to v12 ([87c6d12](https://github.com/halospv3/hce.shared/commit/87c6d12c3ab5243e50a0c1b0cf3dafd6c4c20ffa))
|
|
14
|
+
* **dotnet:** try making the '$(RepoRoot)/publish' directory before zipping ([0241146](https://github.com/halospv3/hce.shared/commit/024114698c89f557513a61400729a609d7637bf0))
|
|
15
|
+
|
|
1
16
|
## [2.0.0](https://github.com/halospv3/hce.shared/compare/v1.2.7...v2.0.0) (2024-03-17)
|
|
2
17
|
|
|
3
18
|
|
package/README.md
CHANGED
|
@@ -3,74 +3,72 @@ Infrastructure resources shared with other HaloSPV3 repositories.
|
|
|
3
3
|
|
|
4
4
|
It is recommended to "install" this repo via [Node Package Manager](#npm)
|
|
5
5
|
|
|
6
|
-
##
|
|
6
|
+
## Usage
|
|
7
7
|
|
|
8
|
-
### Usage
|
|
9
8
|
|
|
10
|
-
|
|
9
|
+
### 1. Install `@halospv3/hce.shared-config`
|
|
11
10
|
|
|
12
|
-
|
|
11
|
+
This project is packaged and published via NPM. As such...
|
|
12
|
+
```sh
|
|
13
|
+
npm install --save-dev @halospv3/hce.shared-config
|
|
14
|
+
```
|
|
13
15
|
|
|
14
|
-
|
|
16
|
+
### 2. Customize Semantic Release
|
|
17
|
+
|
|
18
|
+
WARNING! Defining a property will *overwrite* the previous value. Arrays and objects are *not* merged. You can...
|
|
19
|
+
- Assign to top-level variables to avoid modifying the plugins array.
|
|
20
|
+
- Write your config in CJS and manually merge objects and arrays.
|
|
21
|
+
|
|
22
|
+
**Configs**
|
|
23
|
+
- `hce.shared-config`: [static/.releaserc.yml](static/.releaserc.yml)
|
|
24
|
+
- [dotnet/.releaserc.cjs](dotnet/.releaserc.cjs) based on [BinToss/GroupBox.Avalonia's Semantic Release config](https://github.com/BinToss/GroupBox.Avalonia).
|
|
25
|
+
|
|
26
|
+
**Notable Plugin Properties**
|
|
27
|
+
- [`@semantic-release/commit-analyzer`](https://github.com/semantic-release/commit-analyzer#options)
|
|
28
|
+
- preset (set to conventionalcommits)
|
|
29
|
+
- parserOpts
|
|
30
|
+
- releaseRules
|
|
31
|
+
- [`@semantic-release/release-notes-generator`](https://github.com/semantic-release/release-notes-generator#options)
|
|
32
|
+
- preset (set to conventionalcommits)
|
|
33
|
+
- parserOpts
|
|
34
|
+
- writerOpts
|
|
35
|
+
- [`@semantic-release/changelog`](https://github.com/semantic-release/changelog#options)
|
|
36
|
+
- changelogFile (default: CHANGELOG.md)
|
|
37
|
+
- [`@semantic-release/git`](https://github.com/semantic-release/git#options)
|
|
38
|
+
- assets (default: ['CHANGELOG.md', 'package.json', 'package-lock.json', 'npm-shrinkwrap.json'])
|
|
39
|
+
- `@semantic-release/exec`
|
|
40
|
+
- prepareCmd
|
|
41
|
+
- [`@semantic-release/github`](https://github.com/semantic-release/github#options)
|
|
42
|
+
- assets
|
|
43
|
+
- draftRelease (default: false)
|
|
44
|
+
|
|
45
|
+
### 3. Set Up CommitLint
|
|
15
46
|
|
|
16
47
|
```json
|
|
17
48
|
// package.json
|
|
49
|
+
// body-max-line-length is now a Warning instead of an Error.
|
|
18
50
|
{
|
|
19
51
|
"commitlint": {
|
|
20
52
|
"extends": [
|
|
21
|
-
|
|
22
|
-
]
|
|
53
|
+
"@commitlint/config-conventional"
|
|
54
|
+
],
|
|
55
|
+
"rules": {
|
|
56
|
+
"body-max-line-length": [
|
|
57
|
+
1,
|
|
58
|
+
"always",
|
|
59
|
+
100
|
|
60
|
+
]
|
|
61
|
+
}
|
|
23
62
|
}
|
|
24
63
|
}
|
|
25
64
|
```
|
|
26
65
|
|
|
27
|
-
```
|
|
28
|
-
npx husky
|
|
66
|
+
```sh
|
|
67
|
+
npx husky
|
|
29
68
|
npx husky add .husky/commit-msg 'npx --no -- commitlint --edit ${1}'
|
|
30
69
|
```
|
|
31
70
|
|
|
32
|
-
###
|
|
33
|
-
|
|
34
|
-
#### Need your VersionInfo before the actual release?
|
|
35
|
-
|
|
36
|
-
Make sure you are synced up before doing a dry-run! Semantic-release will fail before printing the version if you aren't synced with the remote!
|
|
37
|
-
Yes, I know that's ridiculous.
|
|
38
|
-
Run `npx semantic-release --dry-run --plugins "@semantic-release/commit-analyzer,semantic-release-export-data"`
|
|
39
|
-
If the first plugin doesn't run into any issues and infers a version bump from unreleased commits, it will print the next version to the console.
|
|
40
|
-
The [second plugin](https://github.com/felipecrs/semantic-release-export-data#readme) will export the next version and other information as GitHub Action Step exports.
|
|
41
|
-
|
|
42
|
-
#### Don't want to publish a Node package?
|
|
43
|
-
|
|
44
|
-
Add the following to your `package.json`:
|
|
45
|
-
```json
|
|
46
|
-
{
|
|
47
|
-
"private": true,
|
|
48
|
-
}
|
|
49
|
-
```
|
|
50
|
-
|
|
51
|
-
## .NET
|
|
52
|
-
|
|
53
|
-
See [dotnet/](dotnet/)
|
|
54
|
-
|
|
55
|
-
GitHub Actions workflow examples are in [dotnet/.github/workflows/](dotnet/.github/workflows/).
|
|
56
|
-
|
|
57
|
-
#### TODO:
|
|
58
|
-
|
|
59
|
-
Eventually, I hope to make boilerplate workflows useable from via relative paths e.g.
|
|
60
|
-
```yml
|
|
61
|
-
jobs:
|
|
62
|
-
release:
|
|
63
|
-
steps:
|
|
64
|
-
- uses: actions/checkout@v3
|
|
65
|
-
- name: dotnet build/publish; copy release artifacts to './publish/'
|
|
66
|
-
uses: ./node_modules/@halospv3/hce.shared/dotnet/.github/workflows/dotnet-release.yml
|
|
67
|
-
with:
|
|
68
|
-
projects:
|
|
69
|
-
- src/lib/lib.csproj
|
|
70
|
-
- src/lib-sample/sample.csproj
|
|
71
|
-
```
|
|
72
|
-
|
|
73
|
-
### Directory.Build.props
|
|
71
|
+
### 4. (dotnet) Add/Edit Directory.Build.props
|
|
74
72
|
|
|
75
73
|
Add the file `Directory.Build.props` to your repository's root directory or solution directory if you haven't already.
|
|
76
74
|
Then, add the following properties:
|
|
@@ -78,7 +76,7 @@ Then, add the following properties:
|
|
|
78
76
|
<Project>
|
|
79
77
|
<PropertyGroup>
|
|
80
78
|
<ProjectRootDir>$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), '.git/index'))</ProjectRootDir>
|
|
81
|
-
<HCESharedDir>$(ProjectRootDir)/node_modules/@halospv3/hce.shared/</HCESharedDir>
|
|
79
|
+
<HCESharedDir>$(ProjectRootDir)/node_modules/@halospv3/hce.shared-config/</HCESharedDir>
|
|
82
80
|
</PropertyGroup>
|
|
83
81
|
</Project>
|
|
84
82
|
```
|
|
@@ -87,10 +85,12 @@ These may evaluate to the following:
|
|
|
87
85
|
| Property | Evaluated Value|
|
|
88
86
|
| - | - |
|
|
89
87
|
|`ProjectRootDir` | `c:\Repos\HaloSPV3\HCE.Shared\` |
|
|
90
|
-
|`HCESharedDir`| `c:\Repos\HaloSPV3\HCE.Shared\node_modules\@halospv3\hce.shared\` |
|
|
88
|
+
|`HCESharedDir`| `c:\Repos\HaloSPV3\HCE.Shared\node_modules\@halospv3\hce.shared-config\` |
|
|
91
89
|
|
|
92
90
|
<br/>
|
|
93
91
|
|
|
92
|
+
#### CI/CD-Only Properties
|
|
93
|
+
|
|
94
94
|
If you want properties set only in a CI/CD environment (e.g. a GitHub workflow), add the following conditional property group to the props file:
|
|
95
95
|
```xml, diff
|
|
96
96
|
<Project>
|
|
@@ -101,16 +101,81 @@ If you want properties set only in a CI/CD environment (e.g. a GitHub workflow),
|
|
|
101
101
|
<PropertyGroup Condition=" '$(CI)' == 'true' ">
|
|
102
102
|
<Configuration>Release</Configuration>
|
|
103
103
|
<ContinuousIntegrationBuild>true</ContinuousIntegrationBuild>
|
|
104
|
+
<Deterministic>true</Deterministic>
|
|
104
105
|
</PropertyGroup>
|
|
105
106
|
</Project>
|
|
106
107
|
```
|
|
107
108
|
> Any properties added to this conditional property group will only be evaluated when `$(CI)` is defined either as a property or as an environment variable. This is most useful for properties such as `ContinuousIntegrationBuild`.
|
|
108
109
|
|
|
109
|
-
|
|
110
|
+
#### GitVersion
|
|
110
111
|
|
|
111
112
|
By default, GitVersion will search only the "current directory" for `GitVersion.yml`. GitVersion has a lesser-known CLI argument, "Path" which allows users to specify the path to `GitVersion.yml`. The NuGet package `GitVersion.MSBuild` exposes this as the read-write property `$(GitVersion_Path)`.
|
|
113
|
+
|
|
114
|
+
If you're satisfied by [dotnet/GitVersion.yml](dotnet/GitVersion.yml), you can configure GitVersion to use this config file. GitVersion does not have 'extend' functionality typical of Node.js packages.
|
|
112
115
|
```xml
|
|
113
116
|
<PropertyGroup>
|
|
114
|
-
<GitVersion_Path
|
|
117
|
+
<GitVersion_Path>$(ProjectRootDir)/node_modules/@halospv3/hce.shared-config/dotnet/GitVersion.yml</GitVersion_Path>
|
|
115
118
|
</PropertyGroup>
|
|
119
|
+
```
|
|
120
|
+
|
|
121
|
+
## Tips
|
|
122
|
+
|
|
123
|
+
### Need your VersionInfo before the actual release?
|
|
124
|
+
|
|
125
|
+
If you want to use this information in other Semantic Release steps, you'll need `semantic-release-export-data`.
|
|
126
|
+
```sh
|
|
127
|
+
npm i -D semantic-release-export-data
|
|
128
|
+
```
|
|
129
|
+
|
|
130
|
+
Run the following to preview the version:
|
|
131
|
+
```sh
|
|
132
|
+
npx semantic-release --dry-run --plugins "@semantic-release/commit-analyzer,semantic-release-export-data"
|
|
133
|
+
```
|
|
134
|
+
If the first plugin doesn't run into any issues and infers a version bump from unreleased commits, it will print the next version to the console.
|
|
135
|
+
The [second plugin](https://github.com/felipecrs/semantic-release-export-data#readme) will export the next version and other information as GitHub Action Step exports.
|
|
136
|
+
|
|
137
|
+
### Don't intend to publish a Node package?
|
|
138
|
+
|
|
139
|
+
Add the following to `package.json`:
|
|
140
|
+
```json
|
|
141
|
+
{
|
|
142
|
+
"private": true,
|
|
143
|
+
}
|
|
144
|
+
```
|
|
145
|
+
|
|
146
|
+
## TODO:
|
|
147
|
+
|
|
148
|
+
### Reusable, configurable GitHub workflows
|
|
149
|
+
|
|
150
|
+
```yml
|
|
151
|
+
jobs:
|
|
152
|
+
release:
|
|
153
|
+
steps:
|
|
154
|
+
- uses: actions/checkout@v3
|
|
155
|
+
- name: dotnet build/publish; copy release artifacts to './publish/'
|
|
156
|
+
uses: ./node_modules/@halospv3/hce.shared/dotnet/.github/workflows/dotnet-release.yml
|
|
157
|
+
with:
|
|
158
|
+
projects:
|
|
159
|
+
- src/lib/lib.csproj
|
|
160
|
+
- src/lib-sample/sample.csproj
|
|
161
|
+
```
|
|
162
|
+
|
|
163
|
+
### Ease Semantic Release Configuration
|
|
164
|
+
|
|
165
|
+
JSON/YAML configs *could* have merge-edit capabilities driven by data from custom, top-level properties. Each property would contain the command moniker and the config data (parameters) similar to RPC implementations.
|
|
166
|
+
This will require quite a bit of datatype validation behind the scenes.
|
|
167
|
+
```json
|
|
168
|
+
{
|
|
169
|
+
"modify_plugins": {
|
|
170
|
+
"op": "Append",
|
|
171
|
+
"data": [
|
|
172
|
+
[
|
|
173
|
+
"newplugin",
|
|
174
|
+
{
|
|
175
|
+
"newpluginoption": true
|
|
176
|
+
}
|
|
177
|
+
]
|
|
178
|
+
]
|
|
179
|
+
}
|
|
180
|
+
}
|
|
116
181
|
```
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
# inspired by https://github.com/GitTools/GitVersion/blob/main/.github/workflows/_unit_tests.yml
|
|
2
|
+
on:
|
|
3
|
+
workflow_call:
|
|
4
|
+
env:
|
|
5
|
+
DOTNET_ROLL_FORWARD: "Major"
|
|
6
|
+
|
|
7
|
+
jobs:
|
|
8
|
+
unit_test:
|
|
9
|
+
name: Unit Tests (${{ matrix.os }})
|
|
10
|
+
strategy:
|
|
11
|
+
fail-fast: false
|
|
12
|
+
matrix:
|
|
13
|
+
os: [windows-latest, ubuntu-latest, macos-latest]
|
|
14
|
+
|
|
15
|
+
runs-on: ${{ matrix.os }}
|
|
16
|
+
steps:
|
|
17
|
+
- uses: actions/checkout@v4
|
|
18
|
+
with:
|
|
19
|
+
fetch-depth: 0
|
|
20
|
+
|
|
21
|
+
- uses: actions/setup-node@v4
|
|
22
|
+
with:
|
|
23
|
+
cache: "npm"
|
|
24
|
+
check-latest: true
|
|
25
|
+
node-version-file: package.json
|
|
26
|
+
- run: npm i -g npm@latest
|
|
27
|
+
|
|
28
|
+
- run: npm ci
|
|
29
|
+
|
|
30
|
+
- uses: actions/setup-dotnet@v4.0.0
|
|
31
|
+
with:
|
|
32
|
+
dotnet-version: "8.x"
|
|
33
|
+
|
|
34
|
+
- run: dotnet test
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
# Inspired by https://github.com/GitTools/GitVersion/blob/main/.github/workflows/ci.yml
|
|
2
|
+
|
|
3
|
+
name: CI
|
|
4
|
+
|
|
5
|
+
on:
|
|
6
|
+
push:
|
|
7
|
+
branches-ignore: # if CI must run on these branches, Release will call CI
|
|
8
|
+
- main
|
|
9
|
+
- develop
|
|
10
|
+
pull_request:
|
|
11
|
+
workflow_call:
|
|
12
|
+
|
|
13
|
+
env:
|
|
14
|
+
DOTNET_ROLL_FORWARD: "Major"
|
|
15
|
+
DOTNET_CLI_TELEMETRY_OPTOUT: 1
|
|
16
|
+
DOTNET_SKIP_FIRST_TIME_EXPERIENCE: 1
|
|
17
|
+
DOTNET_NOLOGO: 1
|
|
18
|
+
|
|
19
|
+
jobs:
|
|
20
|
+
unit_test:
|
|
21
|
+
name: Unit Test
|
|
22
|
+
uses: ./.github/workflows/_unit_test.yml
|
|
@@ -1,9 +1,8 @@
|
|
|
1
|
+
# Test changes locally with https://github.com/nektos/act
|
|
1
2
|
name: dotnet-release
|
|
2
3
|
|
|
3
4
|
# TODO
|
|
4
|
-
# - Get AssemblyName, RuntimeIdentifier (RID) from Directory.Build.props, *.csproj
|
|
5
5
|
# - Allow workflows to be driven by the project(s)
|
|
6
|
-
# - support multiple ASSEMBLYNAME parameters for matrices
|
|
7
6
|
|
|
8
7
|
on:
|
|
9
8
|
push:
|
|
@@ -13,60 +12,42 @@ on:
|
|
|
13
12
|
- "**/*.md"
|
|
14
13
|
- "**/*.txt"
|
|
15
14
|
|
|
16
|
-
permissions:
|
|
17
|
-
contents: write
|
|
18
|
-
issues: write
|
|
19
|
-
pull-requests: write
|
|
20
|
-
|
|
21
15
|
jobs:
|
|
16
|
+
ci:
|
|
17
|
+
name: CI # run test.yml. If it fails, this job fails.
|
|
18
|
+
uses: ./.github/workflows/ci.yml
|
|
22
19
|
release:
|
|
20
|
+
needs: [ci] # start 'release' if 'ci' completes successfully
|
|
23
21
|
runs-on: ubuntu-latest
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
env:
|
|
29
|
-
PROJPATH: "./src/${{ matrix.ASSEMBLYNAME }}.csproj"
|
|
30
|
-
|
|
22
|
+
permissions:
|
|
23
|
+
contents: write
|
|
24
|
+
issues: write
|
|
25
|
+
pull-requests: write
|
|
31
26
|
steps:
|
|
32
|
-
- name: Wait for build to succeed
|
|
33
|
-
uses: lewagon/wait-on-check-action@v1.3.3
|
|
34
|
-
with:
|
|
35
|
-
ref: ${{ github.ref }}
|
|
36
|
-
check-name: 'Build (${{matrix.RID}}, ${{matrix.ASSEMBLYNAME}})'
|
|
37
|
-
repo-token: ${{ secrets.GITHUB_TOKEN }}
|
|
38
|
-
wait-interval: 10
|
|
39
|
-
|
|
40
27
|
################
|
|
41
28
|
# SETUP
|
|
42
29
|
################
|
|
43
30
|
- uses: actions/checkout@v4
|
|
44
31
|
with:
|
|
45
|
-
fetch-depth: 0 # Required by GitVersion
|
|
32
|
+
fetch-depth: 0 # Required by GitVersion, Semantic Release
|
|
46
33
|
submodules: "recursive" # submodule fetch depth unknown
|
|
47
|
-
|
|
34
|
+
|
|
35
|
+
- name: Setup Dotnet
|
|
36
|
+
uses: actions/setup-dotnet@v4
|
|
37
|
+
|
|
48
38
|
- name: Setup Node
|
|
49
39
|
uses: actions/setup-node@v4
|
|
50
|
-
- run: npm ci # Required by Semantic Release
|
|
51
40
|
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
################
|
|
55
|
-
- name: dotnet publish
|
|
56
|
-
run: |
|
|
57
|
-
dotnet publish ${{ matrix.PROJPATH }} -c Release --no-self-contained -p:ContinuousIntegrationBuild=true
|
|
58
|
-
src/.msb.noConfig.ps1
|
|
41
|
+
- name: NPM - Update NPM to Latest
|
|
42
|
+
run: npm install -g npm@latest
|
|
59
43
|
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
- name: Compress Publish Artifacts
|
|
63
|
-
shell: pwsh
|
|
64
|
-
run: |
|
|
65
|
-
$archiveName = "$env:ASSEMBLYNAME.$env:RID.$env:GitVersion_FullSemVer.zip";
|
|
66
|
-
Compress-Archive -Path publish -DestinationPath $archiveName -CompressionLevel Optimal;
|
|
44
|
+
- name: NPM - Clean Install
|
|
45
|
+
run: npm ci # Required by Semantic Release
|
|
67
46
|
|
|
68
47
|
################
|
|
69
48
|
# RELEASE
|
|
49
|
+
# `dotnet publish` must be executed by @semantic-release/exec
|
|
50
|
+
# see 'dotnet/.releaserc.cjs'
|
|
70
51
|
################
|
|
71
52
|
# https://github.com/semantic-release/semantic-release
|
|
72
53
|
- name: Semantic Release
|
|
@@ -74,12 +55,6 @@ jobs:
|
|
|
74
55
|
env:
|
|
75
56
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
76
57
|
|
|
77
|
-
- name: Upload Artifact
|
|
78
|
-
uses: actions/upload-artifact@v4
|
|
79
|
-
with:
|
|
80
|
-
name: publish-artifacts
|
|
81
|
-
path: publish
|
|
82
|
-
|
|
83
58
|
- name: Publish to GitHub Packages
|
|
84
59
|
working-directory: publish
|
|
85
60
|
run: dotnet nuget push *.nupkg -s https://nuget.pkg.github.com/HaloSPV3/index.json -k ${{ secrets.GITHUB_TOKEN }}
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
/** Semantic-Release configuration for GroupBox.Avalonia
|
|
2
|
+
* @extends { hceSharedConfig }
|
|
3
|
+
*
|
|
4
|
+
* <-- TABLE OF CONTENTS -->
|
|
5
|
+
* - Insert-Edit Plugins
|
|
6
|
+
* - Append Plugins
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* @typedef { object } PluginOptionsGit
|
|
11
|
+
* @prop { string } message
|
|
12
|
+
* @prop {[ string | [string] | {path:string} ]} assets
|
|
13
|
+
*/
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* @type {import("semantic-release").Options}
|
|
17
|
+
*/
|
|
18
|
+
const hceSharedConfig = require('@halospv3/hce.shared-config')
|
|
19
|
+
if (process.argv.includes("--debug") || process.argv.includes("--verbose")) {
|
|
20
|
+
console.info("hce.shared-config:\n" + JSON.stringify(hceSharedConfig, null, 2))
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* @type { typeof hceSharedConfig.plugins }
|
|
24
|
+
*/
|
|
25
|
+
const newPlugins = hceSharedConfig.plugins;
|
|
26
|
+
|
|
27
|
+
//#region Insert-Edit Plugins
|
|
28
|
+
/* Insert and/or configure plugins. Can be used to load plugin A's Prepare step
|
|
29
|
+
before plugin B's Prepare step. or edit a plugin's existing configuration */
|
|
30
|
+
for (var i = 0; i < newPlugins.length; i++) {
|
|
31
|
+
/** e.g.
|
|
32
|
+
//#region Git Options | https://github.com/semantic-release/git#options
|
|
33
|
+
// if defined without plugin options, replace with tuple-like array with assets option defined.
|
|
34
|
+
if (plugins[i] === "@semantic-release/git") {
|
|
35
|
+
plugins[i] = [plugins[i], { assets: ["README.md", "CHANGELOG.md"] }]
|
|
36
|
+
}
|
|
37
|
+
if (plugins[i][0] === "@semantic-release/git") {
|
|
38
|
+
// if assets array undefined, define it
|
|
39
|
+
if (!plugins[i][1].assets) {
|
|
40
|
+
plugins[i][1].assets = [];
|
|
41
|
+
}
|
|
42
|
+
// ensure README.md is in assets array
|
|
43
|
+
if (!plugins[i][1].assets.some(a => a === "README.md" || a.path === "README.md")) {
|
|
44
|
+
plugins[i][1].assets.push("README.md");
|
|
45
|
+
}
|
|
46
|
+
// ensure CHANGELOG.md is in assets array
|
|
47
|
+
if (!plugins[i][1].assets.some(a => a === "CHANGELOG.md" || a.path === "CHANGELOG.md")) {
|
|
48
|
+
plugins[i][1].assets.push("CHANGELOG.md");
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
//#endregion Git Options
|
|
52
|
+
*/
|
|
53
|
+
}
|
|
54
|
+
//#endregion Insert-Edit Plugins
|
|
55
|
+
|
|
56
|
+
//#region Append Plugins
|
|
57
|
+
newPlugins.push(
|
|
58
|
+
// APPEND this array of [pluginName, pluginConfig] to plugins
|
|
59
|
+
// https://github.com/semantic-release/exec#usage
|
|
60
|
+
["@semantic-release/exec", {
|
|
61
|
+
// 'ZipPublishDir' zips each publish folder to ./publish/*.zip
|
|
62
|
+
prepareCmd: "dotnet publish ./GroupBox.Avalonia/GroupBox.Avalonia.csproj && dotnet publish ./GroupBox.Avalonia.Sample/GroupBox.Avalonia.Sample.csproj"
|
|
63
|
+
}]
|
|
64
|
+
)
|
|
65
|
+
//#endregion Append Plugins
|
|
66
|
+
|
|
67
|
+
if (process.argv.includes("--debug") || process.argv.includes("--verbose")) {
|
|
68
|
+
console.info("modified plugins array:\n" + JSON.stringify(newPlugins, null, 2))
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
/**
|
|
72
|
+
* @type {import("semantic-release").Options}
|
|
73
|
+
*/
|
|
74
|
+
module.exports = {
|
|
75
|
+
extends: "@halospv3/hce.shared-config",
|
|
76
|
+
plugins: newPlugins
|
|
77
|
+
};
|
|
@@ -1,17 +1,23 @@
|
|
|
1
1
|
<Project>
|
|
2
|
-
<!--
|
|
2
|
+
<!-- todo: refactor to Task so users can configure input variables e.g. ZipPublishDir_AppendVariantArgs -->
|
|
3
3
|
<Target Name="ZipPublishDir" AfterTargets="Publish">
|
|
4
4
|
<PropertyGroup>
|
|
5
|
+
<!-- <ZipPublishDir_AppendVariantArgs>true</ZipPublishDir_AppendVariantArgs> -->
|
|
6
|
+
<!-- "C:/Repos/HaloSPV3/HXE" -->
|
|
5
7
|
<RepoRoot>$([System.IO.Path]::GetDirectoryName($([MSBuild]::GetPathOfFileAbove('.gitignore', '$(MSBuildProjectDirectory)'))))</RepoRoot>
|
|
6
|
-
|
|
7
|
-
<
|
|
8
|
+
<!-- " (net6.0 win7-x86)" -->
|
|
9
|
+
<!-- <PART_VariantArgs Condition="$(ZipPublishDir_AppendVariantArgs)"> ($([System.String]::Join(' ', $(TargetFramework), $(RuntimeIdentifier))))</PART_VariantArgs> -->
|
|
10
|
+
<PART_VariantArgs> ($([System.String]::Join(' ', $(TargetFramework), $(RuntimeIdentifier))))</PART_VariantArgs>
|
|
11
|
+
|
|
12
|
+
<!-- e.g. "C:/Repos/HaloSPV3/HXE/publish/HXE 1.2.3-preview.4 (net6.0 win7-x86).zip" -->
|
|
13
|
+
<Destination>$(RepoRoot)/publish/$(AssemblyName) $(Version)$(PART_VariantArgs).zip</Destination>
|
|
8
14
|
</PropertyGroup>
|
|
9
15
|
|
|
10
|
-
|
|
16
|
+
<MakeDir Directories="$(RepoRoot)/publish/"/>
|
|
11
17
|
|
|
12
18
|
<ZipDirectory
|
|
13
19
|
SourceDirectory="$(PublishDir)"
|
|
14
|
-
DestinationFile="$(Destination)
|
|
20
|
+
DestinationFile="$(Destination)"
|
|
15
21
|
Overwrite="true" />
|
|
16
22
|
</Target>
|
|
17
23
|
</Project>
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@halospv3/hce.shared-config",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.1.0",
|
|
4
4
|
"description": "Automate commit message quality, changelogs, and CI/CD releases. Exports a semantic-release shareable configuration deserialized from this package's '.releaserc.yml'. Shared resources for .NET projects are also distributed with this package.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"halo",
|
|
@@ -44,7 +44,8 @@
|
|
|
44
44
|
"@commitlint/cli": "^19.2.0",
|
|
45
45
|
"@commitlint/config-conventional": "^19.1.0",
|
|
46
46
|
"@semantic-release/changelog": "^6.0.3",
|
|
47
|
-
"@semantic-release/commit-analyzer": "^
|
|
47
|
+
"@semantic-release/commit-analyzer": "^12.0.0",
|
|
48
|
+
"@semantic-release/exec": "^6.0.3",
|
|
48
49
|
"@semantic-release/git": "^10.0.1",
|
|
49
50
|
"@semantic-release/github": "^10.0.2",
|
|
50
51
|
"@semantic-release/npm": "^12.0.0",
|
package/static/.releaserc.yml
CHANGED
|
@@ -20,13 +20,17 @@ plugins: # https://semantic-release.gitbook.io/semantic-release/v/beta/usage/con
|
|
|
20
20
|
- assets:
|
|
21
21
|
- README.md
|
|
22
22
|
- CHANGELOG.md
|
|
23
|
+
# Arbitrary shell commands - https://github.com/semantic-release/exec
|
|
24
|
+
# hint: set 'prepareCmd' to `dotnet publish`. This can be a top-level property!
|
|
25
|
+
# Because this is sorted after @semantic-release/git, the new Git tag will
|
|
26
|
+
# be visible to dotnet (and GitVersion). Dotnet artifacts will be
|
|
27
|
+
# versioned accordingly.
|
|
28
|
+
# Plugins' Steps: https://github.com/semantic-release/semantic-release/blob/master/docs/extending/plugins-list.md
|
|
29
|
+
- "@semantic-release/exec"
|
|
23
30
|
- - "@semantic-release/github"
|
|
24
31
|
- assets:
|
|
25
32
|
- path: ./publish/*
|
|
26
|
-
|
|
33
|
+
|
|
34
|
+
## (OPTIONAL) update static Version strings.
|
|
27
35
|
# https://github.com/jpoehnelt/semantic-release-replace-plugin
|
|
28
36
|
# https://github.com/droidsolutions/semantic-release-update-file
|
|
29
|
-
|
|
30
|
-
## Arbitrary shell commands
|
|
31
|
-
# (useful for `dotnet publish publish/`, but should be run after version tag is pushed so InformationalVersionInfo isn't a subversion)
|
|
32
|
-
# https://github.com/semantic-release/exec
|