From 37807e6cac24cc6f482238b1612b816ee7c024a4 Mon Sep 17 00:00:00 2001 From: SGrottel Date: Sun, 19 May 2024 11:37:59 +0200 Subject: [PATCH 1/4] Build actions for native mini tools --- .github/workflows/Beep.yaml | 55 +++++++++++++++++++++ .github/workflows/HWndToFront.yaml | 77 ++++++++++++++++++++++++++++++ .github/workflows/StartPwsh.yaml | 55 +++++++++++++++++++++ 3 files changed, 187 insertions(+) create mode 100644 .github/workflows/Beep.yaml create mode 100644 .github/workflows/HWndToFront.yaml create mode 100644 .github/workflows/StartPwsh.yaml diff --git a/.github/workflows/Beep.yaml b/.github/workflows/Beep.yaml new file mode 100644 index 0000000..5dc97c8 --- /dev/null +++ b/.github/workflows/Beep.yaml @@ -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.$env:GITHUB_RUN_NUMBER + path: | + beep/bin/${{matrix.platform}}/${{matrix.configuration}} + !**/*.pdb + if-no-files-found: error diff --git a/.github/workflows/HWndToFront.yaml b/.github/workflows/HWndToFront.yaml new file mode 100644 index 0000000..2ca09a4 --- /dev/null +++ b/.github/workflows/HWndToFront.yaml @@ -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 diff --git a/.github/workflows/StartPwsh.yaml b/.github/workflows/StartPwsh.yaml new file mode 100644 index 0000000..1425d23 --- /dev/null +++ b/.github/workflows/StartPwsh.yaml @@ -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.$env:GITHUB_RUN_NUMBER + path: | + StartPwsh/bin/${{matrix.platform}}/${{matrix.configuration}} + !**/*.pdb + if-no-files-found: error From 4d25840036c819112f067e5b606898a89cd127ae Mon Sep 17 00:00:00 2001 From: SGrottel Date: Sun, 19 May 2024 11:45:07 +0200 Subject: [PATCH 2/4] CI Build badges in root README.md --- .github/workflows/Beep.yaml | 2 +- .github/workflows/StartPwsh.yaml | 2 +- README.md | 8 +++++++- StartPwsh/Powershell_black_x48.png | Bin 0 -> 1924 bytes 4 files changed, 9 insertions(+), 3 deletions(-) create mode 100644 StartPwsh/Powershell_black_x48.png diff --git a/.github/workflows/Beep.yaml b/.github/workflows/Beep.yaml index 5dc97c8..8ea3364 100644 --- a/.github/workflows/Beep.yaml +++ b/.github/workflows/Beep.yaml @@ -48,7 +48,7 @@ jobs: if: ${{ matrix.configuration == 'Release' && matrix.platform == 'x64' }} uses: actions/upload-artifact@v4 with: - name: Beep-0.0.0.$env:GITHUB_RUN_NUMBER + name: Beep-0.0.0.${{env:GITHUB_RUN_NUMBER}} path: | beep/bin/${{matrix.platform}}/${{matrix.configuration}} !**/*.pdb diff --git a/.github/workflows/StartPwsh.yaml b/.github/workflows/StartPwsh.yaml index 1425d23..860ca4b 100644 --- a/.github/workflows/StartPwsh.yaml +++ b/.github/workflows/StartPwsh.yaml @@ -48,7 +48,7 @@ jobs: if: ${{ matrix.configuration == 'Release' && matrix.platform == 'x64' }} uses: actions/upload-artifact@v4 with: - name: StartPwsh-0.0.0.$env:GITHUB_RUN_NUMBER + name: StartPwsh-0.0.0.${{env:GITHUB_RUN_NUMBER}} path: | StartPwsh/bin/${{matrix.platform}}/${{matrix.configuration}} !**/*.pdb diff --git a/README.md b/README.md index cc02ac7..ce45639 100644 --- a/README.md +++ b/README.md @@ -11,6 +11,8 @@ Each one is too tiny to justify a repository of it's own.
## 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 @@ -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. @@ -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 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 diff --git a/StartPwsh/Powershell_black_x48.png b/StartPwsh/Powershell_black_x48.png new file mode 100644 index 0000000000000000000000000000000000000000..41672d549b2bb2f1f72cec152121015b5df3a18c GIT binary patch literal 1924 zcmV-~2YdL5P)?V-6ek_WGjL=3#@41os^CU%HBb8Q9C!0Q|*27mXy zj94VjvKf83ZFif*gO886l$n9?<%P(-9_4x3M?HXByAkCa$i9i#m#o}#usT?N4uB0N+ z+0p4r;Ef89;f~2yYv2K3`J&mFbj<_-XlBu;nBPwTP85B%WbBn8z{Y_e1LO&Z!{_(+ z^*dwW31px}Z{MHXd-aRwpr~M^kngaf4%0crabE$E8WpCXV#34_5%$?dps>5M%LIIs z-yeOo9Up(S!|;-nc`n{sQ;TAEo(39PWr{n2MBs)>BXbkmrYozAp`b(#1MtOu%hUlP z$Q{1@u0-&$M1-#1&t3cyy!#Iroscr|?)rKR%gq)hEK39`az>+(q8%efmquaC{&7R^&cATz$?V|;C#Q^e zSUW%jk9SX-iw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q5qe2ZMP0$)$qb zGxHVIiD19(+Bh}Pw@vqT%C8Jt(MO{Y5#)~cHkVc1Kb@^VOQ9lOsLU+SJvL&M!20QQ zP9*Yont0dj^tb+aq0$ckFH~k$UU^f Date: Sun, 19 May 2024 11:47:56 +0200 Subject: [PATCH 3/4] Build actions yaml syntax error typo fixed --- .github/workflows/Beep.yaml | 2 +- .github/workflows/StartPwsh.yaml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/Beep.yaml b/.github/workflows/Beep.yaml index 8ea3364..e791195 100644 --- a/.github/workflows/Beep.yaml +++ b/.github/workflows/Beep.yaml @@ -48,7 +48,7 @@ jobs: if: ${{ matrix.configuration == 'Release' && matrix.platform == 'x64' }} uses: actions/upload-artifact@v4 with: - name: Beep-0.0.0.${{env:GITHUB_RUN_NUMBER}} + name: Beep-0.0.0.${{env.GITHUB_RUN_NUMBER}} path: | beep/bin/${{matrix.platform}}/${{matrix.configuration}} !**/*.pdb diff --git a/.github/workflows/StartPwsh.yaml b/.github/workflows/StartPwsh.yaml index 860ca4b..ae9d3f6 100644 --- a/.github/workflows/StartPwsh.yaml +++ b/.github/workflows/StartPwsh.yaml @@ -48,7 +48,7 @@ jobs: if: ${{ matrix.configuration == 'Release' && matrix.platform == 'x64' }} uses: actions/upload-artifact@v4 with: - name: StartPwsh-0.0.0.${{env:GITHUB_RUN_NUMBER}} + name: StartPwsh-0.0.0.${{env.GITHUB_RUN_NUMBER}} path: | StartPwsh/bin/${{matrix.platform}}/${{matrix.configuration}} !**/*.pdb From 51a027b17986be1f31e5f1b797e4c2c0cc9d8be7 Mon Sep 17 00:00:00 2001 From: SGrottel Date: Sun, 19 May 2024 11:58:00 +0200 Subject: [PATCH 4/4] Selecting run numbers for artifacts names --- .github/workflows/Beep.yaml | 2 +- .github/workflows/StartPwsh.yaml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/Beep.yaml b/.github/workflows/Beep.yaml index e791195..807a48a 100644 --- a/.github/workflows/Beep.yaml +++ b/.github/workflows/Beep.yaml @@ -48,7 +48,7 @@ jobs: if: ${{ matrix.configuration == 'Release' && matrix.platform == 'x64' }} uses: actions/upload-artifact@v4 with: - name: Beep-0.0.0.${{env.GITHUB_RUN_NUMBER}} + name: Beep-0.0.0.${{github.run_number}} path: | beep/bin/${{matrix.platform}}/${{matrix.configuration}} !**/*.pdb diff --git a/.github/workflows/StartPwsh.yaml b/.github/workflows/StartPwsh.yaml index ae9d3f6..c9d716f 100644 --- a/.github/workflows/StartPwsh.yaml +++ b/.github/workflows/StartPwsh.yaml @@ -48,7 +48,7 @@ jobs: if: ${{ matrix.configuration == 'Release' && matrix.platform == 'x64' }} uses: actions/upload-artifact@v4 with: - name: StartPwsh-0.0.0.${{env.GITHUB_RUN_NUMBER}} + name: StartPwsh-0.0.0.${{github.run_number}} path: | StartPwsh/bin/${{matrix.platform}}/${{matrix.configuration}} !**/*.pdb