aero-mail/.forgejo/workflows/release.yml
vodyanoy 598bd61c77
All checks were successful
Release / release (push) Successful in 6m39s
Release API через внутренний сервис кластера вместо Traefik
Загрузка AppImage (~129 МБ) через публичный адрес обрывалась
readTimeout Traefik (60 с): unexpected EOF -> 500/502.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-17 20:36:51 +07:00

135 lines
5.2 KiB
YAML
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

name: Release
on:
push:
branches: [master]
workflow_dispatch:
concurrency:
group: release
cancel-in-progress: false
jobs:
release:
# Пропускаем коммиты от CI (bump версии)
if: "!contains(github.event.head_commit.message, '[skip ci]')"
runs-on: docker
container:
image: electronuserland/builder:wine
env:
# API напрямую через сервис кластера: в обход Traefik (readTimeout 60 с
# обрывал загрузку AppImage) и hairpin-NAT через публичный IP
API: http://forgejo.forgejo.svc.cluster.local:3000/api/v1/repos/vodyanoy/aero-mail
steps:
- name: Checkout (full history for tags)
uses: actions/checkout@v4
with:
fetch-depth: 0
token: ${{ secrets.GITHUB_TOKEN }}
- name: Save release notes (commit message)
run: |
git config --global --add safe.directory "$GITHUB_WORKSPACE"
git log -1 --format=%B > /tmp/release-notes.txt
- name: Determine next version
id: version
run: node .forgejo/version.js
- name: Install dependencies
run: npm ci
- name: Set release version
env:
VERSION: ${{ steps.version.outputs.version }}
run: npm version "${VERSION}" --no-git-tag-version --allow-same-version
- name: Check types
run: npm run typecheck
- name: Run tests
run: |
npm run test:agent
npm run test:realtime
npm run test:compose
npm run test:navigation
- name: Build application
run: npm run build
- name: Build Linux AppImage
timeout-minutes: 20
run: npx electron-builder --linux --x64 --publish=never
- name: Check Linux artifacts
env:
VERSION: ${{ steps.version.outputs.version }}
run: test -s "dist/aero-mail-${VERSION}.AppImage"
- name: Build Windows installer
timeout-minutes: 20
env:
DEBUG: electron-builder
run: npx electron-builder --win --x64 --publish=never
- name: Check Windows artifacts
env:
VERSION: ${{ steps.version.outputs.version }}
run: |
test -s "dist/aero-mail-${VERSION}-win-x64.exe"
test -s "dist/aero-mail-${VERSION}-win-x64.exe.blockmap"
test -s dist/latest.yml
- name: Commit version and create tag
env:
VERSION: ${{ steps.version.outputs.version }}
TAG: ${{ steps.version.outputs.tag }}
GIT_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
git config user.email "ci@vodyanoysh.ru"
git config user.name "Forgejo CI"
git remote set-url origin "https://x-token:${GIT_TOKEN}@git.vodyanoysh.ru/vodyanoy/aero-mail.git"
git add package.json package-lock.json
git diff --cached --quiet || git commit -m "Обновлена версия до ${VERSION} [skip ci]"
git push origin master
git tag "${TAG}"
git push origin "${TAG}"
- name: Create Forgejo release
id: release
env:
TAG: ${{ steps.version.outputs.tag }}
TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
# Тело релиза — сообщение коммита, сохранённое до коммита версии
PAYLOAD=$(node -e 'const fs = require("fs"); console.log(JSON.stringify({ tag_name: process.env.TAG, name: "Aero Mail " + process.env.TAG, body: fs.readFileSync("/tmp/release-notes.txt", "utf8").trim(), draft: false, prerelease: false }))')
RELEASE=$(curl -sf -X POST \
-H "Authorization: token ${TOKEN}" \
-H "Content-Type: application/json" \
-d "${PAYLOAD}" \
"${API}/releases")
RELEASE_ID=$(printf '%s' "$RELEASE" | node -e 'let input = ""; process.stdin.on("data", chunk => { input += chunk }); process.stdin.on("end", () => { const release = JSON.parse(input); if (!Number.isSafeInteger(release.id)) throw new Error("Некорректный ID релиза"); process.stdout.write(String(release.id)) })')
printf '%s' "${RELEASE_ID}" > /tmp/release-id.txt
- name: Upload Linux and Windows release files
env:
TOKEN: ${{ secrets.GITHUB_TOKEN }}
VERSION: ${{ steps.version.outputs.version }}
run: |
RELEASE_ID=$(cat /tmp/release-id.txt)
# Только цифры: защита от ANSI-цветов (FORCE_COLOR) и прочего мусора
printf '%s' "${RELEASE_ID}" | grep -qxE '[0-9]+' || { echo "Некорректный ID релиза: $(printf '%s' "${RELEASE_ID}" | od -c)"; exit 1; }
for ASSET_PATH in "dist/aero-mail-${VERSION}.AppImage" "dist/aero-mail-${VERSION}-win-x64.exe" "dist/aero-mail-${VERSION}-win-x64.exe.blockmap" dist/latest.yml; do
ASSET_NAME=$(basename "${ASSET_PATH}")
URL="${API}/releases/${RELEASE_ID}/assets?name=${ASSET_NAME}"
curl --globoff --fail-with-body --silent --show-error -X POST \
-H "Authorization: token ${TOKEN}" \
-H "Content-Type: application/octet-stream" \
--data-binary @"${ASSET_PATH}" \
"${URL}"
done