-
Notifications
You must be signed in to change notification settings - Fork 149
136 lines (121 loc) · 4.16 KB
/
release.yml
File metadata and controls
136 lines (121 loc) · 4.16 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
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
name: Release
on:
push:
tags: ['v*']
workflow_dispatch:
env:
APP_NAME: fetch-github-hosts
jobs:
create-release:
permissions:
contents: write
runs-on: ubuntu-latest
outputs:
release_id: ${{ steps.create.outputs.result }}
steps:
- uses: actions/checkout@v4
- name: Create draft release
id: create
uses: actions/github-script@v7
with:
script: |
const tagName = context.ref.replace('refs/tags/', '') || 'v4.0';
const { data } = await github.rest.repos.createRelease({
owner: context.repo.owner,
repo: context.repo.repo,
tag_name: tagName,
name: `Fetch Github Hosts ${tagName}`,
body: `See the assets below to download the app for your platform.\n\n**macOS**: \`.dmg\` (Universal binary - supports both Intel & Apple Silicon)\n**Windows**: \`.msi\` / \`.exe\`\n**Linux**: \`.deb\` / \`.AppImage\`\n**Linux Standalone Binary**: \`.tar.gz\` (amd64 / aarch64, no installation needed)`,
draft: true,
prerelease: false
});
return data.id;
result-encoding: string
build-tauri:
needs: create-release
permissions:
contents: write
strategy:
fail-fast: false
matrix:
include:
# macOS - Universal binary (Intel + Apple Silicon)
- platform: macos-latest
args: --target universal-apple-darwin
rust_targets: aarch64-apple-darwin,x86_64-apple-darwin
name: macos-universal
# Linux x86_64
- platform: ubuntu-22.04
args: ''
rust_targets: ''
name: linux-x86_64
# Linux ARM64
- platform: ubuntu-22.04-arm
args: ''
rust_targets: ''
name: linux-aarch64
# Windows
- platform: windows-latest
args: ''
rust_targets: ''
name: windows-x86_64
runs-on: ${{ matrix.platform }}
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: lts/*
cache: 'npm'
- name: Install Rust stable
uses: dtolnay/rust-toolchain@stable
with:
targets: ${{ matrix.rust_targets }}
- name: Rust cache
uses: swatinem/rust-cache@v2
with:
workspaces: './src-tauri -> target'
- name: Install system dependencies (Linux)
if: contains(matrix.name, 'linux')
run: |
sudo apt-get update
sudo apt-get install -y \
libwebkit2gtk-4.1-dev \
libappindicator3-dev \
librsvg2-dev \
patchelf \
pkg-config \
libglib2.0-dev \
libgtk-3-dev \
libgdk-pixbuf2.0-dev \
libpango1.0-dev \
libatk1.0-dev \
libcairo-gobject2 \
libjavascriptcoregtk-4.1-dev
- name: Install frontend dependencies
run: npm ci
- name: Build static frontend
run: npx cross-env NUXT_CLI_WRAPPER=false npx nuxt generate
- name: Build Tauri app
uses: tauri-apps/tauri-action@v0
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
releaseId: ${{ needs.create-release.outputs.release_id }}
args: ${{ matrix.args }}
- name: Package standalone binary (Linux)
if: contains(matrix.name, 'linux')
run: |
ARCH=$([[ "${{ matrix.name }}" == *"aarch64"* ]] && echo "aarch64" || echo "amd64")
BINARY="src-tauri/target/release/fetch-github-hosts"
TAR_NAME="fetch-github-hosts_linux_${ARCH}.tar.gz"
tar -czf "$TAR_NAME" -C "$(dirname "$BINARY")" "$(basename "$BINARY")"
echo "TAR_NAME=$TAR_NAME" >> "$GITHUB_ENV"
- name: Upload standalone binary (Linux)
if: contains(matrix.name, 'linux')
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
TAG_NAME=${GITHUB_REF#refs/tags/}
gh release upload "$TAG_NAME" "$TAR_NAME" --repo "${{ github.repository }}" --clobber