90 lines
2.8 KiB
YAML
90 lines
2.8 KiB
YAML
name: Build Windows App
|
|
|
|
on:
|
|
push:
|
|
branches:
|
|
- main
|
|
- master
|
|
workflow_dispatch:
|
|
|
|
jobs:
|
|
build-windows:
|
|
runs-on: ubuntu-latest
|
|
env:
|
|
GH_TOKEN: ${{ secrets.REGISTRY_TOKEN }}
|
|
GITHUB_TOKEN: ${{ secrets.REGISTRY_TOKEN }}
|
|
REGISTRY_TOKEN: ${{ secrets.REGISTRY_TOKEN }}
|
|
CSC_LINK: ${{ secrets.WINDOWS_CSC_LINK }}
|
|
CSC_KEY_PASSWORD: ${{ secrets.WINDOWS_CSC_KEY_PASSWORD }}
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Setup Node.js
|
|
uses: actions/setup-node@v4
|
|
with:
|
|
node-version: 22
|
|
registry-url: https://registry.npmjs.org
|
|
|
|
- name: Install Windows build dependencies
|
|
run: |
|
|
if command -v sudo >/dev/null 2>&1; then
|
|
SUDO=sudo
|
|
else
|
|
SUDO=
|
|
fi
|
|
|
|
$SUDO dpkg --add-architecture i386
|
|
$SUDO apt-get update
|
|
$SUDO apt-get install -y --no-install-recommends wine wine64 wine32
|
|
wine --version
|
|
|
|
- name: Install dependencies
|
|
run: npm install
|
|
|
|
- name: Audit production dependencies
|
|
run: npm audit --omit=dev --audit-level=high
|
|
|
|
- name: Build Windows installer
|
|
run: npm run dist:win
|
|
|
|
- name: Upload Windows artifacts
|
|
uses: actions/upload-artifact@v3
|
|
with:
|
|
name: envhelper-windows
|
|
path: |
|
|
release/*.exe
|
|
release/*.blockmap
|
|
release/*.yml
|
|
release/*.yaml
|
|
|
|
- name: Publish to Gitea package registry
|
|
shell: bash
|
|
run: |
|
|
app_version="$(node -p "require('./package.json').version")"
|
|
package_version="${app_version}-${GITHUB_SHA::7}"
|
|
|
|
for artifact in release/*; do
|
|
[ -f "$artifact" ] || continue
|
|
file_name="$(basename "$artifact")"
|
|
curl --fail-with-body \
|
|
--user "MrSphay:${REGISTRY_TOKEN}" \
|
|
--upload-file "$artifact" \
|
|
"https://git.wilkensxl.de/api/packages/MrSphay/generic/envhelper/${package_version}/${file_name}"
|
|
done
|
|
|
|
latest_url="https://git.wilkensxl.de/api/packages/MrSphay/generic/envhelper/latest"
|
|
curl --silent --show-error --user "MrSphay:${REGISTRY_TOKEN}" --request DELETE "${latest_url}" || true
|
|
|
|
mkdir -p package-latest
|
|
cp "release/EnvHelper-${app_version}-setup-x64.exe" "package-latest/EnvHelper-setup-x64.exe"
|
|
cp "release/EnvHelper-${app_version}-portable-x64.exe" "package-latest/EnvHelper-portable-x64.exe"
|
|
|
|
for artifact in package-latest/*; do
|
|
file_name="$(basename "$artifact")"
|
|
curl --fail-with-body \
|
|
--user "MrSphay:${REGISTRY_TOKEN}" \
|
|
--upload-file "$artifact" \
|
|
"${latest_url}/${file_name}"
|
|
done
|