Repository navigation
110 lines (93 loc) · 2.91 KB
/
Copy pathrelease.yml
File metadata and controls
110 lines (93 loc) · 2.91 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
name: Build and Release
on:
push:
branches: [main]
tags:
- 'v*'
workflow_dispatch:
inputs:
version:
description: 'Version to release (e.g., 3.0.1)'
required: false
permissions:
contents: write
jobs:
build:
runs-on: ${{ matrix.os }}
strategy:
matrix:
include:
- os: ubuntu-latest
target: linux-x64
artifact: codev
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Setup Bun
uses: oven-sh/setup-bun@v2
with:
bun-version: 1.3.11
- name: Install dependencies
run: bun install --frozen-lockfile
- name: Build binary
run: bun run build
env:
# Enable all experimental features for release builds
BUN_FEATURE_FLAGS: all
- name: Rename binary
run: |
if [ "${{ matrix.artifact }}" != "codev" ]; then
mv dist/codev dist/${{ matrix.artifact }}
fi
chmod +x dist/${{ matrix.artifact }}
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: ${{ matrix.artifact }}
path: dist/${{ matrix.artifact }}
release:
needs: build
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Get version
id: version
run: |
if [ "${{ github.event_name }}" = "workflow_dispatch" ] && [ -n "${{ github.event.inputs.version }}" ]; then
echo "version=${{ github.event.inputs.version }}" >> $GITHUB_OUTPUT
elif [ "${{ github.ref_type }}" = "tag" ]; then
echo "version=${GITHUB_REF#refs/tags/v}" >> $GITHUB_OUTPUT
else
echo "version=$(grep '"version"' package.json | cut -d'"' -f4)" >> $GITHUB_OUTPUT
fi
- name: Download all artifacts
uses: actions/download-artifact@v4
with:
path: artifacts
- name: Display structure of downloaded files
run: ls -laR artifacts
- name: Create Release
uses: softprops/action-gh-release@v2
with:
tag_name: v${{ steps.version.outputs.version }}
name: Codev v${{ steps.version.outputs.version }}
body: |
## Codev ${{ steps.version.outputs.version }}
### Downloads
- **Linux x64**: `codev`
### Install
```bash
# Download and install
curl -fsSL https://raw.githubusercontent.com/chenbhao/Codev/main/install.sh | bash
```
Or download directly:
```bash
# Linux
curl -Lo ~/.local/bin/codev https://github.com/chenbhao/Codev/releases/download/v${{ steps.version.outputs.version }}/codev
chmod +x ~/.local/bin/codev
```
files: |
artifacts/**/*
draft: false
prerelease: false