Skip to content

Release

Release #78

Workflow file for this run

name: Release
on:
workflow_dispatch:
inputs:
version:
description: 'Release Version'
required: true
env:
UID_VERSION: v4.0.6
ICE_ADAPTER_VERSION: 3.3.9
BUILD_VERSION: ${{ github.event.inputs.version }}
jobs:
build-windows:
environment: deploy
runs-on: windows-latest
outputs:
MSI_SUM: ${{ steps.checksum.outputs.MSI_SUM }}
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: 3.12
cache: pip
- name: Install dependencies
run: |
python -m pip install --upgrade pip
python -m pip install -r win_requirements.txt
- name: Test with pytest
run: |
python runtests.py -vv --full-trace
- name: Download ICE adapter and UID calculator
run: |
mkdir build_setup\ice-adapter
Invoke-WebRequest -Uri "https://github.com/FAForever/uid/releases/download/$($env:UID_VERSION)/faf-uid.exe" -OutFile ".\\build_setup\\faf-uid.exe"
Invoke-WebRequest -Uri "https://github.com/FAForever/java-ice-adapter/releases/download/$($env:ICE_ADAPTER_VERSION)/faf-ice-adapter-$($env:ICE_ADAPTER_VERSION)-win.jar" -OutFile ".\\build_setup\\ice-adapter\\faf-ice-adapter.jar"
- name: Download JDK and create JRE
run: |
Invoke-WebRequest -Uri "https://download.oracle.com/java/21/latest/jdk-21_windows-x64_bin.zip" -OutFile ".\\windows-jdk.zip"
7z x windows-jdk.zip -ojdk
pushd jdk
mv $(ls) jdk
popd
$ICE_ADAPTER_JAVA_MODULES=((jdk/jdk/bin/jdeps.exe -s "build_setup/ice-adapter/faf-ice-adapter.jar" | findstr "java" | ForEach-Object { $_.split(" ")[2] }) -join ",")
jdk/jdk/bin/jlink.exe --add-modules "$ICE_ADAPTER_JAVA_MODULES,jdk.crypto.ec,jdk.unsupported" --strip-debug --no-man-pages --no-header-files --compress "zip-6" --output "build_setup/ice-adapter/jre"
- name: Build application
run: |
python setup.py bdist_msi
- name: Calculate checksum
id: checksum
run: |
$MSI_SUM = $(Get-FileHash dist/*).hash
Write-Host $MSI_SUM
echo "MSI_SUM=$MSI_SUM" >> "$env:GITHUB_OUTPUT"
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: client-windows
path: dist/*
build-linux:
runs-on: ubuntu-latest
environment: release
outputs:
TAR_SUM: ${{ steps.checksum.outputs.TAR_SUM }}
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: 3.12
cache: pip
- name: Install dependencies
run: |
sudo apt-get update
sudo apt-get install --no-install-recommends -y \
libxkbcommon-x11-0 \
x11-utils \
libyaml-dev \
libegl1-mesa \
libxcb-icccm4 \
libxcb-image0 \
libxcb-keysyms1 \
libxcb-randr0 \
libxcb-render-util0 \
libxcb-xinerama0 \
libopengl0 \
libxcb-cursor0 \
pulseaudio
python -m pip install --upgrade pip
python -m pip install -r requirements.txt
python -m pip install pytest-xvfb
- name: Test with pytest
run: |
python runtests.py -vv --full-trace
- name: Download ICE adapter and UID calculator
run: |
mkdir -p build_setup/ice-adapter
wget -O build_setup/faf-uid "https://github.com/FAForever/uid/releases/download/$UID_VERSION/faf-uid"
chmod +x build_setup/faf-uid
wget "https://github.com//FAForever/java-ice-adapter/releases/download/$ICE_ADAPTER_VERSION/faf-ice-adapter-$ICE_ADAPTER_VERSION-win.jar" -O "build_setup/ice-adapter/faf-ice-adapter.jar"
- name: Download JDK and create JRE
run: |
wget -O "jdk.tar.gz" "https://download.oracle.com/java/21/latest/jdk-21_linux-x64_bin.tar.gz"
mkdir jdk
tar -xzvf jdk.tar.gz -C jdk --strip-components=1
ICE_ADAPTER_JAVA_MODULES=$(jdk/bin/jdeps -s build_setup/ice-adapter/faf-ice-adapter.jar | cut -d' ' -f 3 | grep java | xargs echo | tr ' ' ',')
jdk/bin/jlink --add-modules "$ICE_ADAPTER_JAVA_MODULES,jdk.crypto.ec,jdk.unsupported" --strip-debug --no-man-pages --no-header-files --compress "zip-6" --output "build_setup/ice-adapter/jre"
- name: Build application
run: |
python3 setup.py build
python3 post_setup.py
tar -C "build" -cvzf "faforever.tar.gz" "faf_python_client"
- name: Calculate checksum
id: checksum
run: |
TAR_SUM=$(echo faforever.tar.gz -n | sha256sum)
echo $TAR_SUM
echo "TAR_SUM=$TAR_SUM" >> "$GITHUB_OUTPUT"
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: client-linux
path: faforever.tar.gz
create-release:
needs: [build-windows, build-linux]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Download Windows artifact
uses: actions/download-artifact@v4
with:
name: client-windows
path: release-artifacts/
- name: Download Linux artifact
uses: actions/download-artifact@v4
with:
name: client-linux
path: release-artifacts/
- name: Create draft release
id: create_release
uses: ncipollo/release-action@v1.14.0
with:
commit: ${{ github.sha }}
tag: ${{ github.event.inputs.version }}
body: "SHA256 (Windows): ${{ needs.build-windows.outputs.MSI_SUM }}\nSHA256 (Linux): ${{ needs.build-linux.outputs.TAR_SUM }}"
draft: true
prerelease: true
artifacts: "release-artifacts/*"