Skip to content

Commit d75d2d1

Browse files
committed
ci: separate release workflows
1 parent c79bf77 commit d75d2d1

File tree

3 files changed

+169
-178
lines changed

3 files changed

+169
-178
lines changed

.github/workflows/build-and-release.yml

Lines changed: 0 additions & 178 deletions
This file was deleted.
Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
name: Build Sponsored
2+
3+
on:
4+
workflow_dispatch:
5+
6+
jobs:
7+
build-sponsored:
8+
name: Build Sponsored for ${{ matrix.os }}
9+
runs-on: ${{ matrix.os }}
10+
strategy:
11+
matrix:
12+
include:
13+
- os: macos-latest
14+
platform: mac
15+
- os: windows-latest
16+
platform: win
17+
- os: ubuntu-latest
18+
platform: linux
19+
20+
steps:
21+
- name: Checkout code
22+
uses: actions/checkout@v4
23+
with:
24+
fetch-depth: 0
25+
26+
- name: Setup pnpm
27+
uses: pnpm/action-setup@v4
28+
with:
29+
version: latest
30+
31+
- name: Setup Node.js
32+
uses: actions/setup-node@v4
33+
with:
34+
node-version: 20.16.0
35+
cache: pnpm
36+
37+
- name: Install dependencies
38+
run: pnpm install
39+
40+
- name: Rebuild native dependencies
41+
run: pnpm run rebuild
42+
43+
- name: Build application (sponsored)
44+
run: pnpm run build:sponsored:${{ matrix.platform }}
45+
env:
46+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
47+
VITE_SPONSORED: true
48+
49+
- name: Upload artifacts
50+
uses: actions/upload-artifact@v4
51+
with:
52+
name: sponsored-${{ matrix.platform }}-${{ github.ref_name }}
53+
path: |
54+
dist/*.dmg
55+
dist/*.pkg
56+
dist/*.exe
57+
dist/*.msi
58+
dist/*.AppImage
59+
dist/*.snap
60+
if-no-files-found: warn
61+
retention-days: 30
62+
63+

.github/workflows/release.yml

Lines changed: 106 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,106 @@
1+
name: Release
2+
3+
on:
4+
push:
5+
tags:
6+
- 'v*'
7+
workflow_dispatch:
8+
inputs:
9+
tag:
10+
description: 'Tag for release (e.g., v1.0.0)'
11+
required: true
12+
default: v4.0.0
13+
14+
jobs:
15+
build:
16+
name: Build for ${{ matrix.os }}
17+
runs-on: ${{ matrix.os }}
18+
strategy:
19+
matrix:
20+
include:
21+
- os: macos-latest
22+
platform: mac
23+
- os: windows-latest
24+
platform: win
25+
- os: ubuntu-latest
26+
platform: linux
27+
28+
steps:
29+
- name: Checkout code
30+
uses: actions/checkout@v4
31+
with:
32+
fetch-depth: 0
33+
34+
- name: Setup pnpm
35+
uses: pnpm/action-setup@v4
36+
with:
37+
version: latest
38+
39+
- name: Setup Node.js
40+
uses: actions/setup-node@v4
41+
with:
42+
node-version: 20.16.0
43+
cache: pnpm
44+
45+
- name: Install dependencies
46+
run: pnpm install
47+
48+
- name: Rebuild native dependencies
49+
run: pnpm run rebuild
50+
51+
- name: Build application
52+
run: pnpm run build:${{ matrix.platform }}
53+
env:
54+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
55+
56+
- name: Upload artifacts
57+
uses: actions/upload-artifact@v4
58+
with:
59+
name: masscode-${{ matrix.platform }}-${{ github.ref_name || inputs.tag }}
60+
path: |
61+
dist/*.dmg
62+
dist/*.pkg
63+
dist/*.exe
64+
dist/*.msi
65+
dist/*.AppImage
66+
dist/*.snap
67+
!dist/*-sponsored.*
68+
!dist/*.yml
69+
!dist/*.blockmap
70+
if-no-files-found: warn
71+
retention-days: 30
72+
73+
release:
74+
name: Create Release
75+
needs: build
76+
runs-on: ubuntu-latest
77+
78+
steps:
79+
- name: Checkout code
80+
uses: actions/checkout@v4
81+
82+
- name: Download artifacts from "build" job
83+
uses: actions/download-artifact@v4
84+
with:
85+
pattern: masscode-*
86+
path: artifacts
87+
88+
- name: Generate changelog
89+
run: npx changelogithub --output release-notes.md
90+
env:
91+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
92+
93+
- name: Create Release
94+
id: create_release
95+
uses: softprops/action-gh-release@v2
96+
with:
97+
files: artifacts/**/*
98+
tag_name: ${{ github.ref_name || inputs.tag }}
99+
draft: true
100+
body_path: release-notes.md
101+
generate_release_notes: true
102+
append_body: true
103+
env:
104+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
105+
106+

0 commit comments

Comments
 (0)