Skip to content

Workflow file for this run

name: Continuous delivery - Windows
on:
release:
types: [prereleased, released]
jobs:
version-check:
name: Check versioning
runs-on: windows-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Install required packages
run: choco install poetry --source python
- name: Create virtual envrionment
run: make init
- name: Check version tag format
run: |
$VERSION_TAG="${{ github.event.release.tag_name }}"
if ($VERSION_TAG -match "^v[0-9]+.[0-9]+.[0-9]+$") {exit 0} else {exit 1}
- name: Check if version tag and package version are equal
run: |
Invoke-Expression "$(poetry env info --path)\Scripts\Activate.ps1"
$VERSION_TAG="${{ github.event.release.tag_name }}"
$VERSION_PACKAGE=python -c "from nitrokeyapp import __version__; print(__version__)"
if ($VERSION_TAG.Substring(1) -eq $VERSION_PACKAGE) {exit 0} else {exit 1}
build-onedir:
name: Build onedir
runs-on: windows-latest
needs: version-check
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Install required packages
run: choco install poetry --source python
- name: Create virtual environment
run: poetry install
- name: Create Windows version info file
run: |
Invoke-Expression "$(poetry env info --path)\Scripts\Activate.ps1"
create-version-file `
--outfile .\ci-scripts\windows\pyinstaller\file_version_info.txt `
--version "$(python -c 'from nitrokeyapp import __version__; print(__version__)')" `
.\ci-scripts\windows\pyinstaller\file_version_info_metadata.yaml
- name: Build onedir
run: |
Invoke-Expression "$(poetry env info --path)\Scripts\Activate.ps1"
pyinstaller ci-scripts/windows/pyinstaller/nitrokey-app-onedir.spec
- name: Upload artifacts
uses: actions/upload-artifact@v4
with:
name: nitrokey-app-onedir
path: dist/nitrokey-app
build-onefile:
name: Build onefile
runs-on: windows-latest
needs: version-check
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Install required packages
run: choco install poetry --source python
- name: Create virtual environment
run: poetry install
- name: Create Windows version info file
run: |
Invoke-Expression "$(poetry env info --path)\Scripts\Activate.ps1"
create-version-file `
--outfile .\ci-scripts\windows\pyinstaller\file_version_info.txt `
--version "$(python -c 'from nitrokeyapp import __version__; print(__version__)')" `
.\ci-scripts\windows\pyinstaller\file_version_info_metadata.yaml
- name: Build onefile
run: |
Invoke-Expression "$(poetry env info --path)\Scripts\Activate.ps1"
pyinstaller ci-scripts/windows/pyinstaller/nitrokey-app-onefile.spec
- name: Upload artifacts
uses: actions/upload-artifact@v4
with:
name: nitrokey-app-onefile
path: dist/nitrokey-app.exe
build-msi-installer:
name: Build MSI installer
runs-on: windows-latest
needs: build-onedir
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Download artifact
uses: actions/download-artifact@v4
with:
name: nitrokey-app-onedir
path: dist/nitrokey-app
- name: Create sources file
run: |
$Env:Path += ";" + "$Env:WIX" + "bin"
heat `
dir .\dist\nitrokey-app\ `
-dr INSTALLFOLDER `
-ag `
-cg ApplicationFilesDynamic `
-ke `
-srd -sfrag -suid -sreg `
-nologo `
-pog:Binaries `
-pog:Documents `
-pog:Satellites `
-pog:Sources `
-pog:Content `
-o Sources.wxs
- name: Build object files
run: |
$Env:Path += ";" + "$Env:WIX" + "bin"
candle .\ci-scripts\windows\wix\Product.wxs -o Product.wixobj
candle .\Sources.wxs -o .\Sources.wixobj
- name: Build installer package
run: |
$Env:Path += ";" + "$Env:WIX" + "bin"
light `
-b .\dist\nitrokey-app\ `
-sice:ICE80 `
.\Product.wixobj `
.\Sources.wixobj `
-o nitrokey-app.msi
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: nitrokey-app-installer
path: nitrokey-app.msi
publish-binary:
name: Publish binary
runs-on: windows-latest
needs: build-onefile
permissions:
contents: write
steps:
- name: Download artifact
uses: actions/download-artifact@v4
with:
name: nitrokey-app-onefile
- name: Rename binary
run: |
mv `
nitrokey-app.exe `
nitrokey-app-${{ github.event.release.tag_name }}-x64-windows-binary_unsigned.exe
- name: Publish release
uses: softprops/action-gh-release@v1
with:
files: nitrokey-app-${{ github.event.release.tag_name }}-x64-windows-binary_unsigned.exe
publish-msi-installer:
name: Publish MSI installer
runs-on: windows-latest
needs: build-msi-installer
permissions:
contents: write
steps:
- name: Download artifact
uses: actions/download-artifact@v4
with:
name: nitrokey-app-installer
- name: Rename installer
run: |
mv `
nitrokey-app.msi `
nitrokey-app-${{ github.event.release.tag_name }}-x64-windows-installer_unsigned.msi
- name: Publish release
uses: softprops/action-gh-release@v1
with:
files: nitrokey-app-${{ github.event.release.tag_name }}-x64-windows-installer_unsigned.msi