Merge ci-landing-only: Gitea builds landing only, DMG is local
This commit is contained in:
+8
-107
@@ -2,13 +2,8 @@ name: Build
|
|||||||
on:
|
on:
|
||||||
push:
|
push:
|
||||||
branches: [main, master]
|
branches: [main, master]
|
||||||
tags: ["v*"]
|
|
||||||
paths:
|
paths:
|
||||||
- "landing/**"
|
- "landing/**"
|
||||||
- "app/**"
|
|
||||||
- "crates/**"
|
|
||||||
- "Cargo.toml"
|
|
||||||
- "Cargo.lock"
|
|
||||||
- ".gitea/workflows/build.yaml"
|
- ".gitea/workflows/build.yaml"
|
||||||
|
|
||||||
env:
|
env:
|
||||||
@@ -20,44 +15,15 @@ permissions:
|
|||||||
packages: write
|
packages: write
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
# ---------------------------------------------------------------------------
|
|
||||||
# Decide what changed so we don't rebuild the (slow) DMG on a landing-only edit
|
|
||||||
# and vice versa. Tags always build everything (release).
|
|
||||||
# ---------------------------------------------------------------------------
|
|
||||||
changes:
|
|
||||||
name: Detect changes
|
|
||||||
runs-on: ubuntu-22.04
|
|
||||||
container: catthehacker/ubuntu:act-latest
|
|
||||||
outputs:
|
|
||||||
landing: ${{ steps.filter.outputs.landing }}
|
|
||||||
app: ${{ steps.filter.outputs.app }}
|
|
||||||
steps:
|
|
||||||
- uses: actions/checkout@v3
|
|
||||||
with: { fetch-depth: 2 }
|
|
||||||
- id: filter
|
|
||||||
uses: dorny/paths-filter@v3
|
|
||||||
with:
|
|
||||||
filters: |
|
|
||||||
landing:
|
|
||||||
- 'landing/**'
|
|
||||||
app:
|
|
||||||
- 'app/**'
|
|
||||||
- 'crates/**'
|
|
||||||
- 'Cargo.toml'
|
|
||||||
- 'Cargo.lock'
|
|
||||||
|
|
||||||
# ---------------------------------------------------------------------------
|
|
||||||
# Landing → static nginx image pushed to the Gitea registry.
|
# Landing → static nginx image pushed to the Gitea registry.
|
||||||
# ---------------------------------------------------------------------------
|
# (The macOS .dmg is built locally via `make dmg` — Tauri can't cross-compile
|
||||||
|
# a macOS bundle on a Linux runner, and there is no self-hosted macOS runner.)
|
||||||
landing:
|
landing:
|
||||||
name: Build & push landing
|
name: Build & push landing
|
||||||
needs: changes
|
|
||||||
if: needs.changes.outputs.landing == 'true' || startsWith(github.ref, 'refs/tags/')
|
|
||||||
runs-on: ubuntu-22.04
|
runs-on: ubuntu-22.04
|
||||||
container: catthehacker/ubuntu:act-latest
|
container: catthehacker/ubuntu:act-latest
|
||||||
outputs:
|
outputs:
|
||||||
version: ${{ steps.version.outputs.VERSION }}
|
version: ${{ steps.version.outputs.VERSION }}
|
||||||
status: ${{ steps.build.outcome }}
|
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v3
|
- uses: actions/checkout@v3
|
||||||
- name: Read version
|
- name: Read version
|
||||||
@@ -70,7 +36,6 @@ jobs:
|
|||||||
username: ${{ github.actor }}
|
username: ${{ github.actor }}
|
||||||
password: ${{ secrets.TOKEN }}
|
password: ${{ secrets.TOKEN }}
|
||||||
- name: Build and push
|
- name: Build and push
|
||||||
id: build
|
|
||||||
uses: docker/build-push-action@v6
|
uses: docker/build-push-action@v6
|
||||||
with:
|
with:
|
||||||
context: ./landing
|
context: ./landing
|
||||||
@@ -80,86 +45,22 @@ jobs:
|
|||||||
${{ env.REGISTRY }}/${{ env.IMAGE_PREFIX }}/spacesh-landing:${{ steps.version.outputs.VERSION }}
|
${{ env.REGISTRY }}/${{ env.IMAGE_PREFIX }}/spacesh-landing:${{ steps.version.outputs.VERSION }}
|
||||||
${{ env.REGISTRY }}/${{ env.IMAGE_PREFIX }}/spacesh-landing:latest
|
${{ env.REGISTRY }}/${{ env.IMAGE_PREFIX }}/spacesh-landing:latest
|
||||||
|
|
||||||
# ---------------------------------------------------------------------------
|
|
||||||
# macOS app → universal (Intel + Apple Silicon) .dmg.
|
|
||||||
# REQUIRES a self-hosted macOS runner labelled `macos` — Tauri cannot
|
|
||||||
# cross-compile a macOS bundle from Linux. The DMG is UNSIGNED (no Developer
|
|
||||||
# ID secrets configured); Gatekeeper will warn on first open. To sign+notarize
|
|
||||||
# later, set APPLE_CERTIFICATE / APPLE_SIGNING_IDENTITY / APPLE_ID secrets and
|
|
||||||
# pass them through to `tauri build`.
|
|
||||||
# ---------------------------------------------------------------------------
|
|
||||||
dmg:
|
|
||||||
name: Build macOS DMG
|
|
||||||
needs: changes
|
|
||||||
if: needs.changes.outputs.app == 'true' || startsWith(github.ref, 'refs/tags/')
|
|
||||||
runs-on: macos
|
|
||||||
outputs:
|
|
||||||
version: ${{ steps.version.outputs.VERSION }}
|
|
||||||
status: ${{ steps.build.outcome }}
|
|
||||||
steps:
|
|
||||||
- uses: actions/checkout@v3
|
|
||||||
- name: Read version
|
|
||||||
id: version
|
|
||||||
run: echo "VERSION=$(node -p "require('./app/src-tauri/tauri.conf.json').version")" >> $GITHUB_OUTPUT
|
|
||||||
- name: Setup Node
|
|
||||||
uses: actions/setup-node@v4
|
|
||||||
with:
|
|
||||||
node-version: 20
|
|
||||||
- name: Install Rust + macOS targets
|
|
||||||
run: |
|
|
||||||
if ! command -v rustup >/dev/null; then
|
|
||||||
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y
|
|
||||||
echo "$HOME/.cargo/bin" >> $GITHUB_PATH
|
|
||||||
export PATH="$HOME/.cargo/bin:$PATH"
|
|
||||||
fi
|
|
||||||
rustup target add aarch64-apple-darwin x86_64-apple-darwin
|
|
||||||
- name: Install frontend deps
|
|
||||||
working-directory: app
|
|
||||||
run: npm ci
|
|
||||||
- name: Build universal DMG
|
|
||||||
id: build
|
|
||||||
working-directory: app
|
|
||||||
run: npm run tauri build -- --target universal-apple-darwin
|
|
||||||
- name: Collect DMG
|
|
||||||
run: |
|
|
||||||
set -euo pipefail
|
|
||||||
mkdir -p dist
|
|
||||||
cp app/src-tauri/target/universal-apple-darwin/release/bundle/dmg/*.dmg dist/
|
|
||||||
ls -lh dist
|
|
||||||
- name: Upload DMG artifact
|
|
||||||
uses: actions/upload-artifact@v3
|
|
||||||
with:
|
|
||||||
name: spacesh-dmg-${{ steps.version.outputs.VERSION }}
|
|
||||||
path: dist/*.dmg
|
|
||||||
|
|
||||||
# ---------------------------------------------------------------------------
|
|
||||||
# Summary → Max.
|
|
||||||
# ---------------------------------------------------------------------------
|
|
||||||
notify:
|
notify:
|
||||||
name: Notify Max
|
name: Notify Max
|
||||||
needs: [landing, dmg]
|
needs: landing
|
||||||
if: always()
|
if: always()
|
||||||
runs-on: ubuntu-22.04
|
runs-on: ubuntu-22.04
|
||||||
container: catthehacker/ubuntu:act-latest
|
container: catthehacker/ubuntu:act-latest
|
||||||
steps:
|
steps:
|
||||||
- name: Compose & send summary
|
- name: Compose & send summary
|
||||||
run: |
|
run: |
|
||||||
line_for() {
|
case "${{ needs.landing.result }}" in
|
||||||
local name="$1" result="$2" ver="$3"
|
success) line="✅ spacesh-landing собран (\`${{ needs.landing.outputs.version }}\`)";;
|
||||||
case "$result" in
|
failure) line="❌ spacesh-landing — ошибка сборки";;
|
||||||
success) echo "✅ $name собран (\`$ver\`)";;
|
*) line="❔ spacesh-landing — ${{ needs.landing.result }}";;
|
||||||
failure) echo "❌ $name — ошибка сборки";;
|
|
||||||
skipped) echo "➖ $name без изменений";;
|
|
||||||
*) echo "❔ $name — $result";;
|
|
||||||
esac
|
esac
|
||||||
}
|
|
||||||
summary=""
|
|
||||||
summary="$summary"$'\n'"$(line_for spacesh-landing '${{ needs.landing.result }}' '${{ needs.landing.outputs.version }}')"
|
|
||||||
summary="$summary"$'\n'"$(line_for spacesh-dmg '${{ needs.dmg.result }}' '${{ needs.dmg.outputs.version }}')"
|
|
||||||
|
|
||||||
url="${{ gitea.server_url }}/${{ gitea.repository }}/actions/runs/${{ gitea.run_number }}"
|
url="${{ gitea.server_url }}/${{ gitea.repository }}/actions/runs/${{ gitea.run_number }}"
|
||||||
text=$(printf '**Build**%s\n\n[лог](%s)' "$summary" "$url")
|
text=$(printf '**Build landing**\n\n%s\n\n[лог](%s)' "$line" "$url")
|
||||||
|
|
||||||
curl -s -X POST "https://platform-api.max.ru/messages?chat_id=${{ secrets.MAX_CHAT_ID }}" \
|
curl -s -X POST "https://platform-api.max.ru/messages?chat_id=${{ secrets.MAX_CHAT_ID }}" \
|
||||||
-H "Authorization: ${{ secrets.MAX_BOT_TOKEN }}" \
|
-H "Authorization: ${{ secrets.MAX_BOT_TOKEN }}" \
|
||||||
-H "Content-Type: application/json" \
|
-H "Content-Type: application/json" \
|
||||||
|
|||||||
Reference in New Issue
Block a user