#324 fix #46
Workflow file for this run
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
name: "CI/CD" | |
on: | |
workflow_dispatch: | |
push: | |
branches: [ master ] | |
paths-ignore: | |
- '**/*.md' | |
- '**/*.gif' | |
- '**/*.png' | |
- '**/*.gitignore' | |
- '**/*.gitattributes' | |
- LICENSE | |
- tests/* | |
tags: | |
- '[0-9]+.[0-9]+.[0-9]+' | |
pull_request: | |
branches: [ master ] | |
paths-ignore: | |
- '**/*.md' | |
- '**/*.gif' | |
- '**/*.png' | |
- '**/*.gitignore' | |
- '**/*.gitattributes' | |
- LICENSE | |
- tests/* | |
env: | |
# Disable the .NET logo in the console output. | |
DOTNET_NOLOGO: true | |
# Stop wasting time caching packages | |
DOTNET_SKIP_FIRST_TIME_EXPERIENCE: true | |
# Disable sending usage data to Microsoft | |
DOTNET_CLI_TELEMETRY_OPTOUT: true | |
DOTNET_ADD_GLOBAL_TOOLS_TO_PATH: false | |
DOTNET_MULTILEVEL_LOOKUP: 0 | |
# Project name to pack and publish | |
PROJECT_NAME: redmine-net-api | |
BUILD_CONFIGURATION: Release | |
# Set the build number in MinVer. | |
MINVERBUILDMETADATA: build.${{github.run_number}} | |
jobs: | |
build: | |
name: OS ${{ matrix.os }} - dotnet ${{ matrix.dotnet }} | |
runs-on: ${{ matrix.os }} | |
strategy: | |
matrix: | |
os: [ ubuntu-latest]#, windows-latest, macos-latest ] | |
dotnet: [ '7.x.x' ] | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
with: | |
lfs: true | |
fetch-depth: 0 | |
- name: Setup .NET Core | |
uses: actions/setup-dotnet@v3 | |
with: | |
dotnet-version: ${{ matrix.dotnet }} | |
- name: Get Version | |
run: | | |
echo "VERSION=$(git describe --tags --abbrev=0)" >> $GITHUB_ENV | |
- name: Restore | |
run: dotnet restore | |
- name: Build | |
run: | | |
dotnet build --no-restore --configuration $BUILD_CONFIGURATION -p:Version=$VERSION | |
- name: Build Signed | |
if: runner.os == 'Linux' | |
run: dotnet build redmine-net-api.sln --no-restore --configuration $BUILD_CONFIGURATION -p:Version=$VERSION -p:Sign=true | |
- name: Test | |
run: dotnet test --no-restore --no-build --configuration $BUILD_CONFIGURATION | |
- name: Pack && startsWith(github.ref, 'refs/tags') | |
if: runner.os == 'Linux' | |
run: | | |
dotnet pack ./src/redmine-net-api/redmine-net-api.csproj -o ./artifacts --configuration $BUILD_CONFIGURATION -p:Version=$VERSION --include-symbols --include-source -p:SymbolPackageFormat=snupkg | |
- name: Pack Signed && startsWith(github.ref, 'refs/tags') | |
if: runner.os == 'Linux' | |
run: | | |
dotnet pack ./src/redmine-net-api/redmine-net-api.csproj -o ./artifacts --configuration $BUILD_CONFIGURATION -p:Version=$VERSION --include-symbols --include-source -p:Sign=true -p:SymbolPackageFormat=snupkg | |
- uses: actions/upload-artifact@v3 | |
if: runner.os == 'Linux' | |
with: | |
name: artifacts | |
path: ./artifacts | |
deploy: | |
runs-on: ubuntu-latest | |
if: startsWith(github.ref, 'refs/tags') | |
needs: build | |
name: Deploy Packages | |
steps: | |
- uses: actions/download-artifact@v3 | |
with: | |
name: artifacts | |
path: ./artifacts | |
- name: Publish packages | |
run: dotnet nuget push ./artifacts/**.nupkg --source nuget.org -k ${{secrets.NUGET_API_KEY}} |