Files
hdlbuild/.github/workflows/build-deb.yml

97 lines
3.1 KiB
YAML

name: Build Wheels
on:
workflow_dispatch:
push:
branches:
- main
paths:
- "pyproject.toml"
jobs:
build:
runs-on: ubuntu-20.04
steps:
- name: ⚙️ Prepare Environment Variables
run: |
echo "AGENT_TOOLSDIRECTORY=/home/runner/toolcache" >> $GITHUB_ENV
mkdir -p /home/runner/toolcache
- name: 🛒 Checkout Repository
uses: actions/checkout@v4
- name: 🐍 Setup Python
uses: actions/setup-python@v5
with:
python-version: "3.10"
- name: 📦 Install Poetry
run: |
curl -sSL https://install.python-poetry.org | python3 -
echo "$HOME/.local/bin" >> $GITHUB_PATH
poetry self add poetry-plugin-export
- name: 🔧 Install Project Dependencies
run: |
poetry install
- name: 📝 Export requirements.txt
run: |
poetry export --without-hashes --format=requirements.txt > requirements.txt
- name: 📥 Download Wheels for Dependencies
run: |
mkdir -p dist/wheels
poetry run pip install wheel
poetry run pip download --only-binary=:all: --dest dist -r requirements.txt
- name: 🛠 Build Project Wheel
run: |
poetry build -f wheel
- name: 🔌 Install pipx and wheel2deb
run: |
python3 -m pip install --user pipx
python3 -m pipx ensurepath
pipx install wheel2deb
- name: 📦 Install wheel2deb Dependencys
run: |
sudo apt update
sudo apt install -y apt-file dpkg-dev fakeroot build-essential devscripts debhelper
sudo apt-file update
- name: 🛠 Convert Wheel to DEB
run: |
mkdir -p dist/debs
wheel2deb default -v -x dist -o dist/debs
- name: 📦 Clone `packages`-Branch in ./packages
run: |
REPO_URL_BASE="$(echo $GITHUB_SERVER_URL/${{ secrets.TEA_USER }}/debrepo.git | sed 's/^https\?:\/\///')"
REPO_URL="https://${{ secrets.TEA_USER }}:${{ secrets.TEA_PAT }}@$REPO_URL_BASE"
echo "::add-mask::$REPO_URL"
echo "📡 Klone Repository von: $REPO_URL"
git clone --depth 1 --branch packages "$REPO_URL" packages
- name: 📂 Ensure `./packages/hdlbuild` Exists and Copy DEBs
run: |
mkdir -p ./packages/hdlbuild
find dist/debs -type f -name "*.deb" -exec cp {} ./packages/hdlbuild/ \;
- name: 📝 Commit & Push immer
run: |
cd packages
git config user.name "Gitea CI"
git config user.email "ci@yourdomain"
git add hdlbuild/
git commit -m "🔄 Update hdlbuild $(date -u +'%Y-%m-%d %H:%M UTC')" || echo "🧊 Keine Änderungen – leerer Commit"
REPO_URL_BASE="$(echo $GITHUB_SERVER_URL/${{ secrets.TEA_USER }}/debrepo.git | sed 's/^https\?:\/\///')"
REPO_URL="https://${{ secrets.TEA_USER }}:${{ secrets.TEA_PAT }}@$REPO_URL_BASE"
echo "::add-mask::$REPO_URL"
git remote set-url origin "$REPO_URL"
git push origin packages