build: updating release script

This commit is contained in:
Dylan R. E. Moonfire 2021-11-29 18:53:03 -06:00
parent 71c0d4a217
commit 1a95d460be
2 changed files with 25 additions and 22 deletions

View file

@ -1,5 +1,10 @@
include:
- template: Security/SAST.gitlab-ci.yml
stages: stages:
- build - build
- test
- release
default: default:
before_script: before_script:
@ -13,30 +18,19 @@ build:
# Set up the environment. # Set up the environment.
- npx npm install --ci - npx npm install --ci
- npx commitlint-gitlab-ci -x @commitlint/config-conventional - npx commitlint-gitlab-ci -x @commitlint/config-conventional
# Build and test everything.
- dotnet restore - dotnet restore
- dotnet build - dotnet build
#- 'dotnet test --test-adapter-path:. --logger:"junit;LogFilePath=../artifacts/{assembly}-test-result.xml;MethodFormat=Default;FailureBodyFormat=Verbose" --collect:"XPlat Code Coverage"'
# Summarize the output for Gitlab CI reporting.
#- dotnet new tool-manifest
#- dotnet tool install dotnet-reportgenerator-globaltool
#- dotnet tool run reportgenerator -reports:src/*/TestResults/*/coverage.cobertura.xml -targetdir:./coverage "-reporttypes:Cobertura;TextSummary"
#- grep "Line coverage" coverage/Summary.txt
# Perform the release.
- npx semantic-release
rules: rules:
- if: '$CI_COMMIT_TITLE =~ /^chore\(release\)/' - if: $CI_COMMIT_BRANCH
when: never
- if: '$CI_COMMIT_TAG' test:
when: never stage: test
- if: '$CI_COMMIT_BRANCH != $CI_DEFAULT_BRANCH' script:
when: never - 'dotnet test --test-adapter-path:. --logger:"junit;LogFilePath=../artifacts/{assembly}-test-result.xml;MethodFormat=Default;FailureBodyFormat=Verbose" --collect:"XPlat Code Coverage"'
- when: on_success - dotnet new tool-manifest
- dotnet tool install dotnet-reportgenerator-globaltool
- dotnet tool run reportgenerator -reports:src/*/TestResults/*/coverage.cobertura.xml -targetdir:./coverage "-reporttypes:Cobertura;TextSummary"
- grep "Line coverage" coverage/Summary.txt
artifacts: artifacts:
when: always when: always
paths: paths:
@ -49,3 +43,12 @@ build:
- ./**/*test-result.xml - ./**/*test-result.xml
cobertura: cobertura:
- ./coverage/Cobertura.xml - ./coverage/Cobertura.xml
publish:
stage: release
script:
- npm install --ci
- npm run build
- npx semantic-release
rules:
- if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH

View file

@ -1,6 +1,6 @@
module.exports = { module.exports = {
branches: ["main"], branches: ["main"],
message: "chore(release): v${nextRelease.version}\n\n${nextRelease.notes}", message: "chore(release): v${nextRelease.version} [skip ci]\n\n${nextRelease.notes}",
plugins: [ plugins: [
"@semantic-release/commit-analyzer", "@semantic-release/commit-analyzer",
"@semantic-release/release-notes-generator", "@semantic-release/release-notes-generator",