Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Build actions for native mini tools #28

Merged
merged 4 commits into from
May 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
55 changes: 55 additions & 0 deletions .github/workflows/Beep.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
name: Beep Build Action

on:
push:
branches: [ "main" ]
paths:
- .github/workflows/Beep.yaml
- beep/**
pull_request:
branches: [ "main" ]
paths:
- .github/workflows/Beep.yaml
- beep/**
workflow_dispatch:

jobs:
build:
strategy:
fail-fast: false
matrix:
configuration: [Debug, Release]
platform: [x64, x86]
runs-on: windows-latest

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

- name: Add MSBuild to PATH
uses: microsoft/setup-msbuild@v2

- name: Build
working-directory: .
# 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=${{matrix.configuration}} /p:Platform=${{matrix.platform}} beep\beep.sln

- name: Copy Extra Files
if: ${{ matrix.configuration == 'Release' && matrix.platform == 'x64' }}
shell: pwsh
run: |
copy .\LICENSE ./beep/bin/${{matrix.platform}}/${{matrix.configuration}}
.\Scripts\makeProjReadme.ps1 Beep ./beep/bin/${{matrix.platform}}/${{matrix.configuration}}/README.md

- name: Upload Artifacts
if: ${{ matrix.configuration == 'Release' && matrix.platform == 'x64' }}
uses: actions/upload-artifact@v4
with:
name: Beep-0.0.0.${{github.run_number}}
path: |
beep/bin/${{matrix.platform}}/${{matrix.configuration}}
!**/*.pdb
if-no-files-found: error
77 changes: 77 additions & 0 deletions .github/workflows/HWndToFront.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
name: HWndToFront Build Action

on:
push:
branches: [ "main" ]
paths:
- .github/workflows/HWndToFront.yaml
- HWndToFront/**
pull_request:
branches: [ "main" ]
paths:
- .github/workflows/HWndToFront.yaml
- HWndToFront/**
workflow_dispatch:

jobs:
build:
strategy:
fail-fast: false
matrix:
configuration: [Debug, Release]
platform: [x64, x86]
runs-on: windows-latest

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

- name: Add MSBuild to PATH
uses: microsoft/setup-msbuild@v2

- name: Inject build number
shell: pwsh
working-directory: ./HWndToFront
run: |
$vf = get-content "Version.h" -Raw

$vf -match '\n#define\s+HWND_TO_FRONT_VER_MAJOR\s+(\d+)\s*\n' | Out-Null
$major = $Matches[1]
$vf -match '\n#define\s+HWND_TO_FRONT_VER_MINOR\s+(\d+)\s*\n' | Out-Null
$minor = $Matches[1]
$vf -match '\n#define\s+HWND_TO_FRONT_VER_PATCH\s+(\d+)\s*\n' | Out-Null
$patch = $Matches[1]

$nvf = $vf -replace '(\n#define\s+HWND_TO_FRONT_VER_BUILD\s+)(\d+)(\s*\n)',"`${1}$env:GITHUB_RUN_NUMBER`$3"

set-content "Version.h" $nvf -force -nonewline

$version = New-Object System.Version @( $major, $minor, $patch, $env:GITHUB_RUN_NUMBER )
Write-Host "Version number: $version"

Write-Output "FULL_VERSION_NUMBER=$version" >> $env:GITHUB_ENV

- name: Build
working-directory: .
# 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=${{matrix.configuration}} /p:Platform=${{matrix.platform}} HWndToFront\HWndToFront.sln

- name: Copy Extra Files
if: ${{ matrix.configuration == 'Release' && matrix.platform == 'x64' }}
shell: pwsh
run: |
copy .\LICENSE ./HWndToFront/bin/${{matrix.platform}}/${{matrix.configuration}}
.\Scripts\makeProjReadme.ps1 HWndToFront ./HWndToFront/bin/${{matrix.platform}}/${{matrix.configuration}}/README.md

- name: Upload Artifacts
if: ${{ matrix.configuration == 'Release' && matrix.platform == 'x64' }}
uses: actions/upload-artifact@v4
with:
name: HWndToFront-${{env.FULL_VERSION_NUMBER}}
path: |
HWndToFront/bin/${{matrix.platform}}/${{matrix.configuration}}
!**/*.pdb
if-no-files-found: error
55 changes: 55 additions & 0 deletions .github/workflows/StartPwsh.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
name: StartPwsh Build Action

on:
push:
branches: [ "main" ]
paths:
- .github/workflows/StartPwsh.yaml
- StartPwsh/**
pull_request:
branches: [ "main" ]
paths:
- .github/workflows/StartPwsh.yaml
- StartPwsh/**
workflow_dispatch:

jobs:
build:
strategy:
fail-fast: false
matrix:
configuration: [Debug, Release]
platform: [x64, x86]
runs-on: windows-latest

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

- name: Add MSBuild to PATH
uses: microsoft/setup-msbuild@v2

- name: Build
working-directory: .
# 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=${{matrix.configuration}} /p:Platform=${{matrix.platform}} StartPwsh\StartPwsh.sln

- name: Copy Extra Files
if: ${{ matrix.configuration == 'Release' && matrix.platform == 'x64' }}
shell: pwsh
run: |
copy .\LICENSE ./StartPwsh/bin/${{matrix.platform}}/${{matrix.configuration}}
.\Scripts\makeProjReadme.ps1 StartPwsh ./StartPwsh/bin/${{matrix.platform}}/${{matrix.configuration}}/README.md

- name: Upload Artifacts
if: ${{ matrix.configuration == 'Release' && matrix.platform == 'x64' }}
uses: actions/upload-artifact@v4
with:
name: StartPwsh-0.0.0.${{github.run_number}}
path: |
StartPwsh/bin/${{matrix.platform}}/${{matrix.configuration}}
!**/*.pdb
if-no-files-found: error
8 changes: 7 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ Each one is too tiny to justify a repository of it's own.
<br clear="both"/>

## Beep
[![Beep Build Action](https://github.com/sgrottel/tiny-tools-collection/actions/workflows/Beep.yaml/badge.svg)](https://github.com/sgrottel/tiny-tools-collection/actions/workflows/Beep.yaml)

`MessageBeep(MB_OK);`

## ConProgBar
Expand Down Expand Up @@ -48,6 +50,8 @@ A powershell script to print an overview of my stuff on Github.
Utility to launch processes based on global hot keys.

## HWndToFront
[![HWndToFront Build Action](https://github.com/sgrottel/tiny-tools-collection/actions/workflows/HWndToFront.yaml/badge.svg)](https://github.com/sgrottel/tiny-tools-collection/actions/workflows/HWndToFront.yaml)

Brings a window to front in Windows 11.
Can also start an application and bring that's window to front.

Expand Down Expand Up @@ -82,7 +86,9 @@ Unsorted useful scripts, e.g. Pwsh.
## shutdownplannergui
A small GUI, slapped together in C#, around the Shutdown command-line utility.

## StartPwsh
## StartPwsh <img align="left" src="./StartPwsh/Powershell_black_x48.png" style="height:1em" alt="StartPwsh">
[![StartPwsh Build Action](https://github.com/sgrottel/tiny-tools-collection/actions/workflows/StartPwsh.yaml/badge.svg)](https://github.com/sgrottel/tiny-tools-collection/actions/workflows/StartPwsh.yaml)

Trivial tool to start Pwsh.exe and provide an icon. Because...

## TestConApp
Expand Down
Binary file added StartPwsh/Powershell_black_x48.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.