Skip to content

Commit

Permalink
Added a GitHub draft release workflow for v2.57.1
Browse files Browse the repository at this point in the history
  • Loading branch information
gh-andre committed Oct 14, 2024
1 parent 19afb24 commit fcb4b49
Showing 1 changed file with 102 additions and 0 deletions.
102 changes: 102 additions & 0 deletions .github/workflows/draft-release-2.57.1.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,102 @@
#
# This workflow builds a patched up KeePass.exe that uses larger
# font and packages it along with a few more files in an archive
# file, which is uploaded to a GitHub draft release as an asset.
#
# GitHub maintains workflow run numbers per file name. This file
# should be renamed in the new release branch to start a new
# sequence.
#
name: Draft Release 2.57.1

on: workflow_dispatch

env:
VERSION: 2.57.1
BUILD_NUMBER: ${{ github.run_number }}

jobs:
build-packages:
name: Build KeePassFont
runs-on: windows-2022

strategy:
matrix:
display-scaling:
- 150pct
- 200pct
version-ref:
- 2-57-1

# this path is valid only for the windows-2022 runner
env:
VCVARSALL: 'C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Auxiliary\Build\vcvarsall'

defaults:
run:
shell: cmd

steps:
- uses: actions/checkout@v4
name: Checkout source
with:
# fetch the entire history, so we don't have to guess how many commits we need to go back for patching tags
fetch-depth: 0

# patch the original forms (the `for` loop) with the display scaling patches
- name: Patch for ${{ matrix.display-scaling }}
run: |
git diff keepass-${{ matrix.version-ref }} ${{ matrix.version-ref }}-${{ matrix.display-scaling }} -- KeePass/Forms/* > ${{ matrix.version-ref }}-${{ matrix.display-scaling }}.patch
for /F %%p in ('dir /B KeePass\Forms\*') do git show keepass-${{ matrix.version-ref }}:KeePass/Forms/%%p > KeePass\Forms\%%p
patch.exe -p1 --binary --input ${{ matrix.version-ref }}-${{ matrix.display-scaling }}.patch
# build all projects in the solution
- name: Build KeePass.exe
run: |
call "${{ env.VCVARSALL }}" x64
msbuild /nologo /target:Rebuild /property:Configuration=Release;Platform="Any CPU" /nr:false KeePass.sln
# collect and package only files that can be dropped into the installation folder
- name: Create package
run: |
mkdir KeePassFont-${{ env.VERSION }}
mkdir KeePassFont-${{ env.VERSION }}\XSL\
copy /y Build\KeePass\Release\KeePass.exe KeePassFont-${{ env.VERSION }}\
copy /y Build\KeePass\Release\KeePass.XmlSerializers.dll KeePassFont-${{ env.VERSION }}\
copy /y Ext\XSL\KDBX_Dump_HTML.xsl KeePassFont-${{ env.VERSION }}\XSL\
copy /y README.md KeePassFont-${{ env.VERSION }}\
7z a KeePassFont-${{ env.VERSION }}+${{ env.BUILD_NUMBER }}.windows.x64.${{ matrix.display-scaling }}.zip KeePassFont-${{ env.VERSION }}\
- name: Upload packages
uses: actions/upload-artifact@v4
with:
name: KeePassFont-${{ env.VERSION }}+${{ env.BUILD_NUMBER }}.${{ matrix.display-scaling }}
path: KeePassFont-${{ env.VERSION }}+${{ env.BUILD_NUMBER }}.windows.x64.${{ matrix.display-scaling }}.zip

create-draft-release:
name: Create a draft release
runs-on: ubuntu-22.04
needs:
- build-packages

steps:
- name: Download artifacts
uses: actions/download-artifact@v4
# without `name` downloads all artifacts
with:
path: .
# collect all artifacts in the current directory
merge-multiple: true

# create an draft release and upload build artifacts
- name: Create a draft release
uses: softprops/action-gh-release@v2
with:
token : ${{ secrets.GITHUB_TOKEN }}
tag_name: ${{ env.VERSION }}
target_commitish: ${{ github.ref_name }}
name: KeePassFont ${{ env.VERSION }}
draft: true
files: |
KeePassFont-${{ env.VERSION }}+${{ env.BUILD_NUMBER }}.windows.x64.150pct.zip
KeePassFont-${{ env.VERSION }}+${{ env.BUILD_NUMBER }}.windows.x64.200pct.zip

0 comments on commit fcb4b49

Please sign in to comment.