Skip to content

Commit

Permalink
Build on github
Browse files Browse the repository at this point in the history
  • Loading branch information
rstarkov committed Oct 12, 2024
1 parent e20e51d commit 5bcf039
Show file tree
Hide file tree
Showing 2 changed files with 47 additions and 1 deletion.
46 changes: 46 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
name: build

on:
push:
workflow_dispatch:

jobs:
build:
runs-on: windows-latest

steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Prepare version
uses: actions/github-script@v7
with:
script: |
const script = require(require('path').resolve('./.github/workflows/version.js'))
const vs = script({ context, github, firstRev: '9b3f37ae' });
const verStr = vs.formatVersion(`1.$(GitRevCount)-$(GitBranch) [$(GitSha6)/$(yyyy)-$(mm)-$(dd)]`).replace('-main', '');
const verStrUi = vs.formatVersion(`1.$(GitRevCount)-$(GitBranch) ($(yyyy)-$(mm)-$(dd))`).replace('-main', '');
const verNum = vs.formatVersion(`1.$(GitRevCount)`);
core.exportVariable('VER_STR', verStr);
core.exportVariable('VER_NUM', verNum);
vs.updateText('Src/MainWindow.xaml', '- v[dev]', `- v${verStrUi}`);
- name: Install dotnet
uses: actions/setup-dotnet@v4
with:
dotnet-version: '8.x'

- name: dotnet restore
run: dotnet restore

- name: "dotnet publish: ${{ env.VER_STR }}"
run: dotnet publish Src\GitSimpleRewriteHistory.csproj --configuration Release -p:InformationalVersion="${{env.VER_STR}}" -p:Version=${{env.VER_NUM}} -p:FileVersion=${{env.VER_NUM}} -p:AssemblyVersion=${{env.VER_NUM}} -o Publish

- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: GitSimpleRewriteHistory-v${{env.VER_NUM}}
path: Publish
if-no-files-found: error
2 changes: 1 addition & 1 deletion Src/MainWindow.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
mc:Ignorable="d"
Background="{x:Static SystemColors.ControlBrush}"
TextOptions.TextFormattingMode="Display"
Title="Git Simple Rewrite History" Height="590" Width="1200">
Title="Git Simple Rewrite History - v[dev]" Height="590" Width="1200">

<Window.Resources>
<Style TargetType="TextBox">
Expand Down

0 comments on commit 5bcf039

Please sign in to comment.