-
Notifications
You must be signed in to change notification settings - Fork 2
104 lines (94 loc) · 4.02 KB
/
Copy pathrelease.yml
File metadata and controls
104 lines (94 loc) · 4.02 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
name: Release
on:
push:
tags: ['v*']
workflow_dispatch:
inputs:
version:
description: 'Version to release (e.g. 0.1.0)'
required: true
permissions:
contents: write
jobs:
# 1) Create the GitHub Release (draft) up front so each per-platform build job
# uploads straight to it via the Releases API (pattern from pairux.com).
create-release:
runs-on: ubuntu-latest
outputs:
tag: ${{ steps.v.outputs.tag }}
version: ${{ steps.v.outputs.version }}
steps:
- uses: actions/checkout@v5
- id: v
run: |
if [ -n "${{ github.event.inputs.version }}" ]; then V="${{ github.event.inputs.version }}"; else V="${GITHUB_REF_NAME#v}"; fi
echo "version=$V" >> "$GITHUB_OUTPUT"
echo "tag=v$V" >> "$GITHUB_OUTPUT"
- name: Create draft release
env:
GH_TOKEN: ${{ github.token }}
run: |
TAG="${{ steps.v.outputs.tag }}"
if gh release view "$TAG" >/dev/null 2>&1; then
gh release edit "$TAG" --draft
else
gh release create "$TAG" --draft --title "TronBrowser $TAG" --generate-notes
fi
# 2) Build each platform's artifacts on its own runner and upload them.
build:
needs: create-release
strategy:
fail-fast: false
matrix:
include:
- { os: ubuntu-latest, platform: linux }
- { os: macos-latest, platform: macos }
- { os: windows-latest, platform: windows }
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v5
# Runners ship Node preinstalled; these steps only run scripts + packaging,
# so we skip setup-node (its packageManager:pnpm detection causes cache noise).
- name: Sync version
run: node scripts/set-version.mjs "${{ needs.create-release.outputs.version }}"
- name: Package (linux/macos)
if: matrix.platform != 'windows'
run: bash apps/desktop/scripts/build-release.sh "v${{ needs.create-release.outputs.version }}" ${{ matrix.platform }}
- name: Package (linux deb + rpm + AppImage)
if: matrix.platform == 'linux'
run: |
curl -sSfL "https://github.com/goreleaser/nfpm/releases/download/v2.41.0/nfpm_2.41.0_amd64.deb" -o /tmp/nfpm.deb
sudo dpkg -i /tmp/nfpm.deb
sudo apt-get update -qq && sudo apt-get install -y -qq librsvg2-bin
bash distribution/deb-rpm/build.sh "v${{ needs.create-release.outputs.version }}"
bash distribution/appimage/build.sh "v${{ needs.create-release.outputs.version }}"
- name: Package (windows)
if: matrix.platform == 'windows'
shell: pwsh
run: |
$stage = "dist/stage/tronbrowser"
New-Item -ItemType Directory -Force -Path "$stage/extensions" | Out-Null
Copy-Item apps/desktop/launcher/tronbrowser "$stage/tronbrowser"
Copy-Item apps/desktop/launcher/tronbrowser.cmd "$stage/tronbrowser.cmd"
Copy-Item -Recurse apps/desktop/extensions/ai-sidebar "$stage/extensions/ai-sidebar"
Copy-Item LICENSE "$stage/LICENSE"
"v${{ needs.create-release.outputs.version }}" | Out-File -Encoding ascii "$stage/VERSION"
New-Item -ItemType Directory -Force -Path dist | Out-Null
Compress-Archive -Path "dist/stage/tronbrowser" -DestinationPath "dist/tronbrowser-win-x64.zip" -Force
- name: Upload to release
shell: bash
env:
GH_TOKEN: ${{ github.token }}
run: |
shopt -s nullglob
assets=(dist/tronbrowser-*.tar.gz dist/tronbrowser-*.zip dist/*.deb dist/*.rpm dist/*.AppImage)
gh release upload "${{ needs.create-release.outputs.tag }}" "${assets[@]}" --clobber
# 3) Publish (un-draft) once every platform has uploaded.
publish:
needs: [create-release, build]
runs-on: ubuntu-latest
steps:
- name: Un-draft the release
env:
GH_TOKEN: ${{ github.token }}
run: gh release edit "${{ needs.create-release.outputs.tag }}" --draft=false --repo "${{ github.repository }}"