Skip to content

Build 45

Build 45 #67

name: native-executable
on:
push:
tags:
- '*'
permissions:
contents: write
jobs:
build:
name: mousemaster on ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [windows-latest]
steps:
- uses: graalvm/setup-graalvm@v1
with:
java-version: '21'
distribution: 'graalvm'
github-token: ${{ secrets.GITHUB_TOKEN }}
native-image-job-reports: 'true'
- name: Checkout source
uses: actions/checkout@v4
- name: Build jar
run: mvnw clean package
shell: cmd
- name: Find JAR file
id: find_jar
run: |
$jarPath = Get-ChildItem -Recurse -Filter "mousemaster-*-jar-with-dependencies.jar" -Path .\target | Select-Object -First 1
echo "::set-output name=jar_path::$jarPath"
- name: Extract version from JAR file
id: extract_version
run: |
$jarPath = "${{ steps.find_jar.outputs.jar_path }}"
$version = [regex]::match($jarPath, 'mousemaster-(.*?)-jar-with-dependencies\.jar').Groups[1].Value
echo "::set-output name=version::$version"
- name: Build GraalVM native executable
run: mvnw -Pnative -Dagent package
shell: cmd
- name: Rename GraalVM executable
run: ren target\mousemaster.exe mousemaster-without-vcruntime140.exe
- name: Embed VCRUNTIME140.dll
run: pefrmdllembed\pefrmdllembed.exe -impinj target/mousemaster-without-vcruntime140.exe ./pefrmdllembed/VCRUNTIME140.dll target/mousemaster.exe
shell: cmd
- name: Get commit message
id: get_commit_message
run: |
$commitMessage = git log -1 --pretty=%B ${{ github.ref_name }}
$releaseNotes += "### New features and improvements`n"
$releaseNotes += ($commitMessage -split '\r?\n' | Select-Object -Skip 2) -join "`n"
$releaseNotes += "`n"
$releaseNotes += "### Installation`n"
$releaseNotes += "1. Download **mousemaster.exe** (a portable executable).`n"
$releaseNotes += "2. Download one of the existing configuration files:`n"
$releaseNotes += " - **neo-mousekeys.properties** (***recommended***): a WASD configuration ([see documentation](configuration/neo-mousekeys.md))`n"
$releaseNotes += " - **warpd.properties**: an HKJL configuration ([see documentation](configuration/warpd.md))`n"
$releaseNotes += " - **mouseable.properties**: another HKJL configuration ([see documentation](configuration/mouseable.md))`n"
$releaseNotes += " - **author.properties**: an arrow key based configuration optimized for single hand usage ([see documentation](configuration/author.md))`n"
$releaseNotes += "3. Place the executable and the configuration file in the same directory.`n"
$releaseNotes += "4. Rename the configuration file to **mousemaster.properties**.`n"
$releaseNotes += "5. Run **mousemaster.exe**.`n"
Set-Content -Path ./release-notes.txt -Value $releaseNotes
- name: Create release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: gh release create ${{ github.ref_name }} "target/mousemaster.exe" "configuration/author.properties" "configuration/mouseable.properties" "configuration/neo-mousekeys.properties" "configuration/warpd.properties" --title "v${{ steps.extract_version.outputs.version }}" --notes-file ./release-notes.txt