Skip to content

Commit

Permalink
Merge pull request #1 from rinrab/master
Browse files Browse the repository at this point in the history
Create Installer and publish with GitHub Actions.
  • Loading branch information
chemodax authored Jan 5, 2024
2 parents 676a970 + 77db6ed commit d85146f
Show file tree
Hide file tree
Showing 12 changed files with 565 additions and 12 deletions.
35 changes: 35 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
name: Build

on:
push:
branches: [ "master" ]
pull_request:
branches: [ "master" ]

jobs:
build:
runs-on: windows-latest

steps:
- uses: actions/checkout@v3

- name: Add msbuild to PATH
uses: microsoft/setup-msbuild@v1.1

- name: Restore
run: msbuild pbench.sln /t:restore /p:Configuration=Release /p:Platform=x86

- name: Build
run: msbuild pbench.sln /t:build /p:Configuration=Release /p:Platform=x86 /p:RestorePackages=false

- name: Prepare artifact
run: |
mkdir -Path .\artifact
copy -Path .\_bin\Release-x86\pbench.exe -Destination .\artifact
copy -Path .\_bin\Release-x86\en-US\pbench.msi -Destination .\artifact
- name: Upload build artifact
uses: actions/upload-artifact@v3
with:
name: pbench
path: .\artifact
64 changes: 64 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
name: Publish

on:
push:
tags:
- '*'

permissions: write-all

jobs:
create_release:
runs-on: windows-latest

steps:
- name: Create Release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ github.ref }}
release_name: Release ${{ github.ref }}
draft: true
prerelease: false

outputs:
upload_url: ${{ steps.create_release.outputs.upload_url }}

build:
needs: create_release

runs-on: windows-latest

steps:
- uses: actions/checkout@v3

- name: Add msbuild to PATH
uses: microsoft/setup-msbuild@v1.1

- name: Restore
run: msbuild pbench.sln /t:restore /p:Configuration=Release /p:Platform=x86

- name: Build
run: msbuild pbench.sln /t:build /p:Configuration=Release /p:Platform=x86 /p:RestorePackages=false

- name: Upload pbench.msi to Release
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ needs.create_release.outputs.upload_url }}
asset_path: .\_bin\Release-x86\en-US\pbench.msi
asset_name: pbench-${{ github.ref_name }}.msi
asset_content_type: application/msi

- name: Upload pbench.exe to Release
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ needs.create_release.outputs.upload_url }}
asset_path: .\_bin\Release-x86\pbench.exe
asset_name: pbench.exe
asset_content_type: application/exe
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
_bin/*
.vs/*
*.user
*.user
bin
obj
6 changes: 6 additions & 0 deletions Directory.build.props
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<Project>
<Import Project="Version.props" />
<PropertyGroup>
<Version>$(VersionMajor).$(VersionMinor).$(VersionPatch)</Version>
</PropertyGroup>
</Project>
17 changes: 17 additions & 0 deletions Installer/Installer.wixproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<Project Sdk="WixToolset.Sdk/4.0.3">
<PropertyGroup>
<OutputName>pbench</OutputName>
<OutDir>$(SolutionDir)_bin\$(Configuration)-$(Platform)\</OutDir>
<IntermediateOutputPath>$(SolutionDir)_bin\$(Configuration)-$(Platform)\tmp\$(MSBuildProjectName)\</IntermediateOutputPath>
<DefineConstants>Version=$(Version)</DefineConstants>
</PropertyGroup>
<ItemGroup>
<None Include="LICENSE.rtf" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="WixToolset.UI.wixext" Version="4.0.3" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\pbench\pbench.vcxproj" />
</ItemGroup>
</Project>
Loading

0 comments on commit d85146f

Please sign in to comment.