aero-mail/.forgejo/workflows/release.yml
r.rasputin bdc1392b7f
Some checks failed
Release / release (push) Failing after 17m43s
Добавлена сборка Windows в общий релиз
2026-11-17 17:55:57 +07:00

111 lines
4.1 KiB
YAML

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
steps:
- name: Checkout (full history for tags)
uses: actions/checkout@v4
with:
fetch-depth: 0
token: ${{ secrets.GITHUB_TOKEN }}
- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: '22'
- 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 Linux AppImage and Windows installer
run: npm run build && npx electron-builder --linux --win --x64 --publish=never
- name: Check release artifacts
env:
VERSION: ${{ steps.version.outputs.version }}
run: |
test -s "dist/aero-mail-${VERSION}.AppImage"
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: |
RELEASE=$(curl -sf -X POST \
-H "Authorization: token ${TOKEN}" \
-H "Content-Type: application/json" \
-d "{\"tag_name\":\"${TAG}\",\"name\":\"Aero Mail ${TAG}\",\"body\":\"Автоматический релиз для Linux (AppImage) и Windows x64 (установщик).\",\"draft\":false,\"prerelease\":false}" \
"https://git.vodyanoysh.ru/api/v1/repos/vodyanoy/aero-mail/releases")
RELEASE_ID=$(echo "$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 релиза"); console.log(release.id) })')
echo "id=${RELEASE_ID}" >> "$GITHUB_OUTPUT"
- name: Upload Linux and Windows release files
env:
TOKEN: ${{ secrets.GITHUB_TOKEN }}
RELEASE_ID: ${{ steps.release.outputs.id }}
VERSION: ${{ steps.version.outputs.version }}
run: |
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}")
curl --fail-with-body --silent --show-error -X POST \
-H "Authorization: token ${TOKEN}" \
-H "Content-Type: application/octet-stream" \
--data-binary @"${ASSET_PATH}" \
"https://git.vodyanoysh.ru/api/v1/repos/vodyanoy/aero-mail/releases/${RELEASE_ID}/assets?name=${ASSET_NAME}"
done