Skip to content

Commit

Permalink
Fixed build version not parsing
Browse files Browse the repository at this point in the history
  • Loading branch information
TomRichter committed Nov 2, 2020
1 parent 001a6c3 commit 6759e43
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 7 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/UpdateAssemblyInfo.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ Write-Host "Parsed version number: $VERSION_NUMBER"
# Get friendly-length commit hash
$COMMIT_HASH = $Env:GITHUB_SHA.Substring(0, 7)

echo "VERSION_NUMBER=$VERSION_NUMBER" >> $GITHUB_ENV
echo "COMMIT_HASH=$COMMIT_HASH" >> $GITHUB_ENV
echo "VERSION_NUMBER=${VERSION_NUMBER}" >> $GITHUB_ENV
echo "COMMIT_HASH=${COMMIT_HASH}" >> $GITHUB_ENV

# Find every AssemblyInfo.cs
$files = Get-ChildItem -Path "${Env:GITHUB_WORKSPACE}\**\Properties" -Recurse -include "AssemblyInfo.*"
Expand Down
26 changes: 21 additions & 5 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,19 +14,32 @@ jobs:
uses: "actions/checkout@v2"

- name: "Process Version from Tag"
id: "version"
id: "semver"
uses: "ncipollo/semantic-version-action@v1"

- name: "Set Version with Build Number"
id: "version"
env:
BUILD_VERSION: "${{ steps.semver.outputs.tag }}"
shell: "powershell"
run: |
echo "::set-output name=number::${Env:BUILD_VERSION}.${Env:GITHUB_RUN_NUMBER}"
echo "::set-output name=hash::$($Env:GITHUB_SHA.Substring(0, 7))"
- name: "Update Version in AssemblyInfo.cs"
env:
BUILD_VERSION: "${{ steps.version.outputs.number }}"
shell: "powershell"
run: |
.\.github\workflows\UpdateAssemblyInfo.ps1
- name: "Write Version to Text File"
env:
BUILD_VERSION: "${{ steps.version.outputs.number }}"
shell: "powershell"
run: |
echo "source: ${Env:GITHUB_REPOSITORY}" > "${Env:GITHUB_WORKSPACE}\VERSION.md"
echo "version: ${Env:VERSION_NUMBER}" >> "${Env:GITHUB_WORKSPACE}\VERSION.md"
echo "version: ${Env:BUILD_VERSION}" >> "${Env:GITHUB_WORKSPACE}\VERSION.md"
echo "commit: ${Env:GITHUB_SHA}" >> "${Env:GITHUB_WORKSPACE}\VERSION.md"
echo "date: $((Get-Date -format r).ToString())" >> "${Env:GITHUB_WORKSPACE}\VERSION.md"
Expand Down Expand Up @@ -60,17 +73,20 @@ jobs:
.\MSBuild.exe "${Env:GITHUB_WORKSPACE}\" /p:RestoreLockedMode=true /p:Configuration=Release
- name: "Package Artifacts"
env:
BUILD_VERSION: "${{ steps.version.outputs.number }}"
COMMIT_HASH: "${{ steps.version.outputs.hash }}"
shell: "powershell"
run: |
7z a PulsarPluginBootstrapper-${Env:VERSION_NUMBER}-${Env:COMMIT_HASH}.zip README.md VERSION.md .\PulsarInjector\bin\Release\* -xr!'*.pdb' -mx=7
7z a PulsarPluginLoader.dll-${Env:VERSION_NUMBER}-${Env:COMMIT_HASH}.zip README.md VERSION.md .\PulsarPluginLoader\bin\Release\PulsarPluginLoader.dll -mx=7
7z a PulsarPluginBootstrapper-${Env:BUILD_VERSION}-${Env:COMMIT_HASH}.zip README.md VERSION.md .\PulsarInjector\bin\Release\* -xr!'*.pdb' -mx=7
7z a PulsarPluginLoader.dll-${Env:BUILD_VERSION}-${Env:COMMIT_HASH}.zip README.md VERSION.md .\PulsarPluginLoader\bin\Release\PulsarPluginLoader.dll -mx=7
- name: "Publish to GitHub Releases"
uses: "marvinpinto/action-automatic-releases@latest"
with:
repo_token: "${{ secrets.GITHUB_TOKEN }}"
prerelease: false
title: "PPL v$VERSION_NUMBER"
title: "PPL v${{ steps.version.outputs.number }}"
files: |
*.zip
Expand Down

0 comments on commit 6759e43

Please sign in to comment.