-
Notifications
You must be signed in to change notification settings - Fork 1
113 lines (94 loc) · 2.94 KB
/
Copy pathrelease.yml
File metadata and controls
113 lines (94 loc) · 2.94 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
name: Build and Release
on:
push:
tags:
- "v*"
permissions:
contents: write
jobs:
build:
strategy:
matrix:
include:
- os: ubuntu-latest
target: linux-x64
artifact_suffix: linux-x64
- os: ubuntu-24.04-arm
target: linux-arm64
artifact_suffix: linux-arm64
- os: macos-15-intel
target: darwin-x64
artifact_suffix: darwin-x64
- os: macos-latest
target: darwin-arm64
artifact_suffix: darwin-arm64
- os: windows-latest
target: windows-x64
artifact_suffix: windows-x64.exe
runs-on: ${{ matrix.os }}
env:
VERSION: ${{ github.ref_name }}
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Setup Bun
uses: oven-sh/setup-bun@v2
with:
bun-version: 1.2.10
- name: Install dependencies
run: bun install
- name: Install UPX (Linux)
if: runner.os == 'Linux'
run: |
sudo apt-get update
sudo apt-get install -y upx
- name: Install UPX (Windows)
if: runner.os == 'Windows'
run: choco install upx
- name: Compress Bun runtime with UPX (Linux)
if: runner.os == 'Linux'
run: |
BUN_PATH=$(which bun)
echo "Compressing Bun runtime at $BUN_PATH"
upx --best --lzma "$BUN_PATH" || echo "UPX compression of Bun runtime failed, continuing anyway"
- name: Build
run: |
mkdir -p release
VERSION_NUM="${VERSION#v}"
ARTIFACT_NAME="holistics-${VERSION_NUM}-${{ matrix.artifact_suffix }}"
bun build src/index.ts --compile --outfile "release/${ARTIFACT_NAME}" --minify --target "bun-${{ matrix.target }}"
echo "ARTIFACT_NAME=${ARTIFACT_NAME}" >> $GITHUB_ENV
shell: bash
- name: Compress output with UPX (Windows)
if: runner.os == 'Windows'
run: |
upx --best --lzma "release/${{ env.ARTIFACT_NAME }}" || echo "UPX compression failed, continuing anyway"
shell: bash
- name: Test binary
run: |
./release/${{ env.ARTIFACT_NAME }} --help
./release/${{ env.ARTIFACT_NAME }} --version
shell: bash
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: ${{ env.ARTIFACT_NAME }}
path: release/${{ env.ARTIFACT_NAME }}
release:
needs: build
runs-on: ubuntu-latest
steps:
- name: Download all artifacts
uses: actions/download-artifact@v4
with:
path: release
merge-multiple: true
- name: List release files
run: ls -la release/
- name: Create Release
uses: softprops/action-gh-release@v2
with:
files: release/*
generate_release_notes: true
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}