Trigger again #2
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: Build and release | |
on: | |
# Trigger the workflow on push or pull request, | |
# but only for the dev branch | |
push: | |
branches: | |
- main | |
paths: | |
- 'Tracker/**' | |
workflow_dispatch: | |
env: | |
SOLUTION_FILE_PATH: ./Tracker/Tracker.sln | |
# Configuration type to build. | |
# You can convert this to a build matrix if you need coverage of multiple configuration types. | |
# https://docs.github.com/actions/learn-github-actions/managing-complex-workflows#using-a-build-matrix | |
BUILD_CONFIGURATION: Release | |
jobs: | |
build: | |
runs-on: windows-latest | |
steps: | |
- name: Install GitVersion | |
uses: gittools/actions/gitversion/setup@v0 | |
with: | |
versionSpec: '5.x' | |
- name: Checkout | |
uses: actions/checkout@v2 | |
with: | |
fetch-depth: 0 | |
- uses: paulhatch/[email protected] | |
id: versioning | |
with: | |
# The prefix to use to identify tags | |
tag_prefix: "v" | |
# A string which, if present in a git commit, indicates that a change represents a | |
# major (breaking) change, supports regular expressions wrapped with '/' | |
major_pattern: "(MAJOR)" | |
# Same as above except indicating a minor change, supports regular expressions wrapped with '/' | |
minor_pattern: "(MINOR)" | |
# A string to determine the format of the version output | |
version_format: "v${major}.${minor}.${patch}.${increment}" | |
# Optional path to check for changes. If any changes are detected in the path the | |
# 'changed' output will true. Enter multiple paths separated by spaces. | |
change_path: "./Tracker" | |
# Named version, will be used as suffix for name version tag | |
#namespace: project-b | |
# Indicate whether short tags like 'v1' should be supported. If false only full | |
# tags like 'v1.0.0' will be recognized. | |
# If this is set to true, *every* commit will be treated as a new version. | |
bump_each_commit: false | |
# Amended the SetVersion script to do Tracker folder only | |
- name: Update AssemblyVersion and AssemblyFileVersion | |
run: ./SetVersion.ps1 "${{ steps.versioning.outputs.major }}.${{ steps.versioning.outputs.minor }}.${{ steps.versioning.outputs.patch }}.${{ steps.versioning.outputs.increment }}" | |
shell: powershell | |
# - name: Update AssemblyVersion and AssemblyFileVersion | |
# run: ./SetVersion.ps1 "${{ steps.gitversion.outputs.SemVer }}" | |
# shell: powershell | |
- name: Add MSBuild to PATH | |
uses: microsoft/setup-msbuild@v1 | |
- name: Restore NuGet packages | |
working-directory: ${{env.GITHUB_WORKSPACE}} | |
run: nuget restore ${{env.SOLUTION_FILE_PATH}} -PackagesDirectory .\packages -source "https://api.nuget.org/v3/index.json" | |
- name: Build | |
working-directory: ${{env.GITHUB_WORKSPACE}} | |
# Add additional options to the MSBuild command line here (like platform or verbosity level). | |
# See https://docs.microsoft.com/visualstudio/msbuild/msbuild-command-line-reference | |
run: msbuild /m /p:Configuration=${{env.BUILD_CONFIGURATION}} ${{env.SOLUTION_FILE_PATH}} | |
- name: Directory Listing | |
shell: cmd | |
run: dir /s /b | |
- name: Build Artifact Tracker | |
shell: powershell | |
run: Compress-Archive -Path Tracker\Tracker\obj\Release\Tracker.exe -DestinationPath Tracker.zip -Force | |
- name: Create Release | |
id: create_release | |
uses: actions/create-release@latest | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
tag_name: ${{ steps.versioning.outputs.version }} # WAS: ${{ steps.gitversion.outputs.semVer }} | |
release_name: Release ${{ steps.versioning.outputs.version }} # WAS: ${{ steps.gitversion.outputs.semVer }} | |
body: | | |
Automated Release by GitHub Action CI | |
draft: false | |
prerelease: false | |
- name: Upload Release Asset Tracker | |
id: upload-release-asset-Tracker | |
uses: actions/upload-release-asset@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
upload_url: ${{ steps.create_release.outputs.upload_url }} | |
asset_path: ./Tracker.zip | |
asset_name: Tracker.zip | |
asset_content_type: application/zip |