ci: fix syntax #3
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
# Copyright (c) Stéphane ANDRE. | |
# Licensed under the MIT license. | |
# This continuous integration pipeline is triggered anytime a user pushes a tag. Could be trigger by user action. | |
# This pipeline builds solution, update CHANGELOG.md and creates a draft release | |
name: Create Release | |
on: | |
push: | |
tags: | |
- 'v*.*.*' | |
workflow_dispatch: | |
jobs: | |
# GitVersion | |
gitversion: | |
timeout-minutes: 5 | |
runs-on: windows-latest | |
outputs: | |
full_version: ${{ steps.gitversion.outputs.SemVer }} | |
suffix_label: ${{ steps.gitversion.outputs.PreReleaseLabel }} | |
version: ${{ steps.gitversion.outputs.MajorMinorPatch }} | |
steps: | |
# Checkout | |
- name: Checkout | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
# Install Git version | |
- name: Install GitVersion | |
uses: gittools/actions/gitversion/setup@v1.1.1 | |
with: | |
versionSpec: '5.x' | |
# Check Git version | |
- name: Check Git Semantic Version | |
id: gitversion | |
uses: gittools/actions/gitversion/execute@v1.1.1 # https://github.com/GitTools/actions/blob/main/docs/examples/github/gitversion/execute/usage-examples.md | |
with: | |
useConfigFile: true | |
configFilePath: .\.github\GitVersion.yml | |
disableNormalization: true | |
# Build | |
build: | |
uses: avantipoint/workflow-templates/.github/workflows/dotnet-build.yml@master # https://github.com/AvantiPoint/workflow-templates/blob/master/.github/workflows/dotnet-build.yml | |
needs: [ gitversion ] | |
with: | |
name: Build | |
build-args: '/p:GitVersion=${{ needs.gitversion.outputs.full_version }} /p:VersionSuffix=${{ needs.gitversion.outputs.suffix_label }}' | |
dotnet-test-logger: GitHubActions --no-build --no-restore | |
solution-path: .\src\MyIconCreator.sln | |
nugetFeedUrl: ${{ vars.PRIVATE_NUGET_API_SOURCE }} | |
artifact-name: IconCreator | |
artifacts-path: | | |
./build/IconCreator/Release/** | |
!./build/IconCreator/Release/*.xml | |
!./build/IconCreator/Release/*.pdb | |
secrets: | |
nugetUserName: ${{ vars.PRIVATE_NUGET_API_USERNAME }} | |
nugetToken: ${{ secrets.PRIVATE_NUGET_API_KEY }} | |
# Create release | |
release: | |
runs-on: ubuntu-latest | |
needs: [ gitversion, build ] | |
env: | |
DOTNET_SYSTEM_CONSOLE_ALLOW_ANSI_COLOR_REDIRECTION: true | |
DOTNET_SKIP_FIRST_TIME_EXPERIENCE: true | |
DOTNET_NOLOGO: true | |
DOTNET_CLI_TELEMETRY_OPTOUT: true | |
permissions: | |
contents: write | |
steps: | |
# Checkout | |
- name: Checkout | |
uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
# Update CHANGELOG with all conventional commit from previous tag | |
- name: Update CHANGELOG | |
continue-on-error: true | |
id: changelog | |
uses: requarks/changelog-action@v1.10.1 # https://github.com/marketplace/actions/changelog-from-conventional-commits | |
with: | |
token: ${{ github.token }} | |
tag: ${{ github.ref_name }} | |
# Commit changes in CHANGELOG and skip CI | |
- name: Commit CHANGELOG.md | |
continue-on-error: true | |
uses: stefanzweifel/git-auto-commit-action@v4 # https://github.com/marketplace/actions/git-auto-commit | |
with: | |
branch: main | |
commit_message: 'docs: update CHANGELOG.md for ${{ github.ref_name }} [skip ci]' | |
file_pattern: CHANGELOG.md | |
# Download artifacts | |
- uses: actions/download-artifact@v3 | |
with: | |
name: IconCreator | |
path: IconCreator/ | |
# Zip application files | |
- name: Zip artifact for deployment | |
run: zip IconCreator.zip IconCreator/** -r | |
# Get release labels | |
- name: Define release parameters | |
shell: pwsh | |
id: compute_parameters | |
run: | | |
if ('${{ needs.gitversion.outputs.suffix_label }}' -eq '') { | |
echo "release-display-name=${{ needs.gitversion.outputs.version }}" >> $Env:GITHUB_OUTPUT | |
echo "is-preview=false" >> $Env:GITHUB_OUTPUT | |
} else { | |
echo "is-preview=true" >> $Env:GITHUB_OUTPUT | |
if ('${{ needs.gitversion.outputs.suffix_label }}' -eq 'pre') { | |
echo "release-display-name='${{ needs.gitversion.outputs.version }} - Preview'" >> $Env:GITHUB_OUTPUT | |
} elseif ('${{ needs.gitversion.outputs.suffix_label }}' -eq 'alpha') { | |
echo "release-display-name='${{ needs.gitversion.outputs.version }} - Alpha'" >> $Env:GITHUB_OUTPUT | |
} elseif ('${{ needs.gitversion.outputs.suffix_label }}' -eq 'beta') { | |
echo "release-display-name='${{ needs.gitversion.outputs.version }} - Beta'" >> $Env:GITHUB_OUTPUT | |
} | |
} | |
# Create release | |
- uses: ncipollo/release-action@main # https://github.com/marketplace/actions/create-release | |
name: Create Release | |
with: | |
artifacts: "IconCreator.zip" | |
artifactErrorsFailBuild: true | |
draft: true | |
generateReleaseNotes: false | |
token: ${{ github.token }} | |
name: "${{ steps.compute_parameters.outputs.release-display-name }}" | |
prerelease: ${{ steps.compute_parameters.outputs.is-preview }} | |
tag: v${{needs.gitversion.outputs.full_version}} | |
body: ${{ steps.changelog.outputs.changes }} |