Files
WOL-LY/.gitea/workflows/release.yaml

142 lines
4.2 KiB
YAML

name: Build and Release
on:
push:
branches:
- main
jobs:
build-x86_64:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.11'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
- name: Build with PyInstaller
run: |
cd app
pyinstaller --onefile --add-data "ui:ui" wolServer.py
- name: Upload Artifact
uses: actions/upload-artifact@v3
with:
name: executable-x86_64
path: app/dist/wolServer
build-arm:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Install QEMU
uses: docker/setup-qemu-action@v2
- name: Build ARM Executable
run: |
docker run --rm --privileged multiarch/qemu-user-static --reset -p yes
docker buildx create --use
docker buildx build --platform linux/arm/v7 -t arm-builder --load --file - . <<EOF
FROM python:3.11-slim-buster
WORKDIR /app
COPY requirements.txt /app/requirements.txt
COPY app /app/app
RUN apt-get update && apt-get install -y \
build-essential \
zlib1g-dev \
libncurses5-dev \
libgdbm-dev \
libnss3-dev \
libssl-dev \
libreadline-dev \
libffi-dev \
libsqlite3-dev \
tk-dev \
x11proto-core-dev \
x11proto-xext-dev \
x11proto-fonts-dev \
libxrender-dev \
libxtst-dev \
libxext-dev \
libsm-dev \
libx11-dev \
libgl1-mesa-glx \
libgl1-mesa-dri \
libgl1-mesa-dev \
libglu1-mesa-dev \
python3-dev \
&& python -m pip install --upgrade pip \
&& pip install -r /app/requirements.txt \
&& cd app/app \
&& pyinstaller --onefile --add-data "ui:ui" wolServer.py
EOF
- name: Extract ARM Executable
run: |
container_id=$(docker create arm-builder)
docker cp $container_id:/app/app/dist/wolServer app/dist/wolServer
docker rm $container_id
- name: Upload ARM Artifact
uses: actions/upload-artifact@v3
with:
name: executable-arm
path: app/dist/wolServer
release:
needs: [build-x86_64, build-arm]
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Create Release
env:
GITEA_TOKEN: ${{ secrets.mytoken }}
run: |
release_id=$(curl -X POST "https://git.konsthol.eu/api/v1/repos/konsthol/WOL-Ly/releases" \
-H "Authorization: token ${{ secrets.mytoken }}" \
-H "Content-Type: application/json" \
-d '{
"tag_name": "v1.0.0",
"target_commitish": "main",
"name": "v1.0.0",
"body": "Release description",
"draft": false,
"prerelease": false
}' | jq -r '.id')
- name: Upload x86_64 Executable to Release
env:
GITEA_TOKEN: ${{ secrets.mytoken }}
run: |
curl --data-binary "@app/dist/wolServer" \
-H "Authorization: token ${{ secrets.mytoken }}" \
-H "Content-Type: application/octet-stream" \
"https://git.konsthol.eu/api/v1/repos/konsthol/WOL-Ly/releases/${release_id}/assets?name=wolServer-x86_64"
- name: Upload ARM Executable to Release
env:
GITEA_TOKEN: ${{ secrets.mytoken }}
run: |
curl --data-binary "@app/dist/wolServer" \
-H "Authorization: token ${{ secrets.mytoken }}" \
-H "Content-Type: application/octet-stream" \
"https://git.konsthol.eu/api/v1/repos/konsthol/WOL-Ly/releases/${release_id}/assets?name=wolServer-arm"