Bump anothrNick/github-tag-action from 1.67.0 to 1.69.0 #66
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: MSBuild | |
# | |
# Skip the workflow with one of the following: | |
# [skip ci] | |
# [ci skip] | |
# ***NO_CI*** | |
# | |
# Note that a commit MUST include one of the following to create a release: | |
# #patch | |
# #minor | |
# #major | |
# | |
on: | |
workflow_dispatch: | |
branches: [master, yaml] | |
push: | |
branches: [master, yaml] | |
paths-ignore: | |
- '**/*.gitignore' | |
- '**/*.gitattributes' | |
- '**/*.md' | |
- 'LICENSE' | |
pull_request: | |
branches: [master, yaml] | |
paths-ignore: | |
- '**/*.gitignore' | |
- '**/*.gitattributes' | |
- '**/*.md' | |
- 'LICENSE' | |
env: | |
# Path to the solution file relative to the root of the project. | |
SOLUTION_FILE_PATH: .\Timekeeper.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 | |
ARTIFACT_PACKAGE: package-timekeeper | |
concurrency: | |
group: sandbox-msbuild-${{ github.ref }}-1 | |
cancel-in-progress: true | |
# Jobs are run in parallel unless `needs` is specified. | |
# https://docs.github.com/en/actions/learn-github-actions/managing-complex-workflows#creating-dependent-jobs | |
jobs: | |
build: | |
if: (github.event_name == 'workflow_dispatch') || (!contains(toJson(github.event.commits.*.message), '***NO_CI***') && !contains(toJson(github.event.commits.*.message), '[ci skip]') && !contains(toJson(github.event.commits.*.message), '[skip ci]')) | |
# https://docs.github.com/en/actions/using-github-hosted-runners/about-github-hosted-runners | |
runs-on: windows-latest | |
steps: | |
- name: Check out repository | |
uses: actions/checkout@v4 | |
- name: Add MSBuild to PATH | |
uses: microsoft/setup-msbuild@v2 | |
# with: | |
# '[17.0,17.2)]' Use 17.0 to 17.2, exclusive (i.e., not 17.2). | |
# vs-version: '[17.0,)' | |
- name: Restore NuGet packages | |
run: nuget restore ${{env.SOLUTION_FILE_PATH}} | |
- name: Build 32-bit | |
# 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:Platform="Win32" /p:Configuration=${{env.BUILD_CONFIGURATION}} ${{env.SOLUTION_FILE_PATH}} | |
- name: Build 64-bit | |
# 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:Platform="x64" /p:Configuration=${{env.BUILD_CONFIGURATION}} ${{env.SOLUTION_FILE_PATH}} | |
- name: Copy deliverables | |
working-directory: ./installer | |
shell: cmd | |
run: | | |
md files | |
copy /y ..\Win32\Release\Timekeeper.dll files | |
copy /y ..\x64\Release\Timekeeper.dll files\Timekeeper64.dll | |
copy /y ..\help\*.htm files | |
copy /y ..\help\*.png files | |
copy /y ..\help\*.gif files | |
copy /y ..\LICENSE files | |
attrib -r files\*.* | |
# Upload release artifact to share with next job | |
# https://docs.github.com/en/actions/guides/storing-workflow-data-as-artifacts#about-workflow-artifacts | |
# https://github.com/marketplace/actions/upload-a-build-artifact | |
- name: Upload installer files folder as a build artifact | |
uses: actions/upload-artifact@v4 | |
with: | |
name: ${{env.ARTIFACT_PACKAGE}} | |
path: ./installer/files/ | |
retention-days: 1 | |
# Use always() to always run this step even when there are failures | |
#if: ${{ always() }} | |
version: | |
needs: build | |
runs-on: ubuntu-latest | |
# Map a step output to a job output | |
# https://docs.github.com/en/actions/reference/workflow-syntax-for-github-actions#jobsjob_idoutputs | |
outputs: | |
# TagNoV: ${{ steps.StepTagNoV.outputs.new_tag }} | |
TagNoV: ${{ steps.TrimV.outputs.result }} | |
TagPart: ${{ steps.StepTagNoV.outputs.part }} | |
steps: | |
- name: Check out repository | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: '0' | |
# https://github.com/marketplace/actions/github-tag-bump | |
# We want to use the tag without the 'v' prefix for the release name. | |
# The action does not output that, so we perform a dry run to get the tag without 'v'. | |
- name: Get tag without 'v' prefix | |
id: StepTagNoV | |
uses: anothrNick/[email protected] | |
env: | |
DRY_RUN: true | |
DEFAULT_BUMP: none | |
WITH_V: false | |
- name: Output bump type | |
run: echo Bump type=${{ steps.StepTagNoV.outputs.part }} | |
# BUG: `new_tag` has the 'v' even when WITH_V is false. | |
# So, we remove it. | |
- name: Substitute string | |
id: TrimV | |
uses: bluwy/[email protected] | |
with: | |
_input-text: ${{ steps.StepTagNoV.outputs.new_tag }} | |
# This emits a warning which can be ignored. | |
v: '' | |
- name: Output trimmed version | |
run: echo Version=${{ steps.TrimV.outputs.result }} | |
package: | |
needs: version | |
if: needs.version.outputs.TagPart != 'none' | |
runs-on: windows-latest | |
steps: | |
- name: Check out repository | |
uses: actions/checkout@v4 | |
# Download publish artifact from previous job | |
# https://github.com/marketplace/actions/download-a-build-artifact | |
- name: Download deployment folder as a build artifact | |
uses: actions/download-artifact@v4 | |
with: | |
name: ${{env.ARTIFACT_PACKAGE}} | |
path: ./installer/files/ | |
# Delete publish artifact so it does not count against storage | |
# https://github.com/marketplace/actions/delete-artifact | |
- name: Delete build artifact | |
uses: GeekyEggo/delete-artifact@v5 | |
with: | |
name: ${{env.ARTIFACT_PACKAGE}} | |
failOnError: false | |
# https://github.com/lukesampson/scoop | |
# https://github.com/NSIS-Dev/scoop-nsis | |
# https://github.com/NSIS-Dev/github-action-examples/ | |
- name: Install NSIS | |
run: | | |
Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope CurrentUser | |
# From actions/runner-images: | |
# https://github.com/actions/runner-images/blob/main/images/win/scripts/Installers/Install-NSIS.ps1 | |
$NsisVersion = '3.08' | |
Install-Binary -Url "https://downloads.sourceforge.net/project/nsis/NSIS%203/${NsisVersion}/nsis-${NsisVersion}-setup.exe" -Name "nsis-${NsisVersion}-setup.exe" -ArgumentList ('/S') | |
#OLD Invoke-Expression (New-Object System.Net.WebClient).DownloadString('https://get.scoop.sh') | |
#OLD scoop bucket add extras | |
#OLD scoop install nsis | |
#OLD ALT scoop bucket add nsis https://github.com/NSIS-Dev/scoop-nsis | |
#OLD ALT scoop install nsis/nsis | |
makensis -VERSION | |
makensis -HDRINFO | |
- name: Build NSIS installer | |
if: needs.version.outputs.TagNoV | |
shell: cmd | |
working-directory: ./installer | |
run: makensis -DgVerInstaller=${{ needs.version.outputs.TagNoV }}.0 Timekeeper.nsi | |
- name: Upload installer as an artifact | |
uses: actions/upload-artifact@v4 | |
with: | |
name: publish-package | |
path: ./installer/timekeeper-setup.exe | |
retention-days: 1 | |
publish: | |
needs: [ version, package ] | |
runs-on: ubuntu-latest | |
steps: | |
- name: Check out repository | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: '0' | |
- name: Download installer as an artifact | |
uses: actions/download-artifact@v4 | |
with: | |
name: publish-package | |
path: ./installer/ | |
- name: Delete installer artifact | |
uses: GeekyEggo/delete-artifact@v5 | |
with: | |
name: publish-package | |
failOnError: false | |
- name: Bump version and push tag | |
id: StepBump | |
uses: anothrNick/[email protected] | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
DEFAULT_BUMP: none | |
WITH_V: true | |
# (This could be a separate action triggered by pushing a tag.) | |
# https://github.com/marketplace/actions/create-release | |
# This error means that the a release with this tag already exists. | |
# Error 422: Validation Failed: {"resource":"Release","code":"already_exists","field":"tag_name"} | |
- name: Create release with artifact | |
if: success() && needs.version.outputs.TagNoV && steps.StepBump.outputs.new_tag | |
uses: ncipollo/[email protected] | |
with: | |
name: ${{ needs.version.outputs.TagNoV }} | |
tag: ${{ steps.StepBump.outputs.new_tag }} | |
# Note: Using "./release/*" uploads the individual files. | |
artifacts: ./installer/timekeeper-setup.exe | |
token: ${{ secrets.GITHUB_TOKEN }} |