Skip to content

Sync, Build, and Release #36

Sync, Build, and Release

Sync, Build, and Release #36

Workflow file for this run

name: Sync, Build, and Release
on:
schedule:
- cron: '0 * * * *' # Запуск каждый час
workflow_dispatch: # Возможность ручного запуска
jobs:
sync:
runs-on: ubuntu-latest
outputs:
run_build: ${{ steps.sync_upstream.outputs.run_build }}
steps:
# 1. Клонируем форк
- name: Checkout Fork
uses: actions/checkout@v3
with:
repository: nix155/qdomyos-zwift
token: ${{ secrets.PAT_TOKEN }}
fetch-depth: 0
# 2. Настраиваем Upstream и синхронизируем с оригиналом
- name: Sync with Upstream
id: sync_upstream
run: |
git remote add upstream https://github.com/cagnulein/qdomyos-zwift.git
git fetch upstream
if git diff --quiet HEAD upstream/master; then
echo "run_build=false" >> $GITHUB_OUTPUT
else
echo "run_build=true" >> $GITHUB_OUTPUT
git merge upstream/master --no-edit
git push origin master
fi
build:
runs-on: ubuntu-latest
needs: sync
if: ${{ needs.sync.outputs.run_build == 'true' }}
steps:
# 1. Клонируем оригинал
- name: Checkout Original Repository
uses: actions/checkout@v3
with:
repository: cagnulein/qdomyos-zwift
fetch-depth: 0
# 2. Устанавливаем зависимости
- name: Install Dependencies
run: |
sudo apt update -y
sudo apt install --no-install-recommends -y \
git \
ca-certificates \
qtquickcontrols2-5-dev \
qtconnectivity5-dev \
qtbase5-private-dev \
qtpositioning5-dev \
libqt5charts5-dev \
libqt5networkauth5-dev \
libqt5websockets5-dev \
qml-module* \
libqt5texttospeech5-dev \
qtlocation5-dev \
qtmultimedia5-dev \
g++ \
make \
wget \
unzip
# 3. Обновляем подмодули и компилируем проект
- name: Build Binary
run: |
git submodule update --init src/smtpclient/
git submodule update --init src/qmdnsengine/
git submodule update --init tst/googletest/
pushd src
qmake qdomyos-zwift.pro
make -j$(nproc)
popd
# 4. Упаковываем бинарник с добавлением даты
- name: Package Binary
run: |
mkdir -p dist
TIMESTAMP=$(date +"%Y%m%d-%H%M")
ARC_PATH="dist/qdomyos-zwift-${TIMESTAMP}.tar.gz"
echo "FILE_PATH=$ARC_PATH" >> $GITHUB_ENV
tar -czvf "$ARC_PATH" src/qdomyos-zwift
ls -lah src/
ls -lah dist/
# 5. Создаём релиз и публикуем упакованный бинарник
- name: Create Release
id: create_release
uses: actions/create-release@v1
with:
tag_name: ${{ github.run_number }}
release_name: "Release ${{ github.run_number }}"
draft: false
prerelease: false
env:
GITHUB_TOKEN: ${{ secrets.PAT_TOKEN }}
# 6. Загружаем артефакт в релиз
- name: Upload Release Asset
uses: actions/upload-release-asset@v1
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ${{ env.FILE_PATH }}
asset_name: qdomyos-zwift.tar.gz
asset_content_type: application/gzip
env:
GITHUB_TOKEN: ${{ secrets.PAT_TOKEN }}
build-and-push-webgl:
runs-on: ubuntu-latest
if: ${{ needs.sync.outputs.run_build == 'true' }}
needs: sync
steps:
# 1. Клонируем оригинал
- name: Checkout Original Repository
uses: actions/checkout@v3
with:
repository: cagnulein/qdomyos-zwift
fetch-depth: 0
# 2. Логинимся в DockerHub
- name: Log in to DockerHub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
# 3. Сборка и пуш WebGL-образа
- name: Build and Push WebGL Image
run: |
TIMESTAMP=$(date +"%Y%m%d-%H%M")
IMAGE_NAME="${{ secrets.DOCKER_NAMESPACE }}/qdomyos-zwift-webgl"
docker build -t $IMAGE_NAME:latest -t $IMAGE_NAME:$TIMESTAMP -f docker/linux_webgl/Dockerfile .
docker push $IMAGE_NAME:latest
docker push $IMAGE_NAME:$TIMESTAMP
build-and-push-gui-vnc:
runs-on: ubuntu-latest
if: ${{ needs.sync.outputs.run_build == 'true' }}
needs: sync
steps:
# 1. Клонируем оригинал
- name: Checkout Original Repository
uses: actions/checkout@v3
with:
repository: cagnulein/qdomyos-zwift
fetch-depth: 0
# 2. Логинимся в DockerHub
- name: Log in to DockerHub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
# 3. Сборка и пуш GUI VNC-образа
- name: Build and Push GUI VNC Image
run: |
TIMESTAMP=$(date +"%Y%m%d-%H%M")
IMAGE_NAME="${{ secrets.DOCKER_NAMESPACE }}/qdomyos-zwift-gui-vnc"
docker build -t $IMAGE_NAME:latest -t $IMAGE_NAME:$TIMESTAMP -f docker/linux_gui_vnc/Dockerfile .
docker push $IMAGE_NAME:latest
docker push $IMAGE_NAME:$TIMESTAMP