-
Notifications
You must be signed in to change notification settings - Fork 765
118 lines (102 loc) · 3.4 KB
/
Copy pathdev-release.yml
File metadata and controls
118 lines (102 loc) · 3.4 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
name: Dev Release (main)
on:
push:
branches: [main]
concurrency:
group: dev-release-${{ github.ref }}
cancel-in-progress: false
jobs:
compute-version:
runs-on: ubuntu-latest
outputs:
dev_version: ${{ steps.version.outputs.dev_version }}
tag_name: ${{ steps.version.outputs.tag_name }}
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '20.18.1'
- name: Compute dev version
id: version
run: |
BASE_VERSION=$(node -p "require('./package.json').version")
DEV_VERSION="${BASE_VERSION}-dev.${{ github.run_number }}"
echo "dev_version=${DEV_VERSION}" >> "${GITHUB_OUTPUT}"
echo "tag_name=v${DEV_VERSION}" >> "${GITHUB_OUTPUT}"
echo "Dev version: ${DEV_VERSION}"
build-binaries:
needs: compute-version
strategy:
fail-fast: false
matrix:
include:
- os: ubuntu-latest
target: bun-linux-x64
asset: kode-linux-x64
- os: ubuntu-latest
target: bun-linux-arm64
asset: kode-linux-arm64
- os: macos-latest
target: bun-darwin-x64
asset: kode-darwin-x64
- os: macos-latest
target: bun-darwin-arm64
asset: kode-darwin-arm64
- os: windows-latest
target: bun-windows-x64
asset: kode-win32-x64.exe
runs-on: ${{ matrix.os }}
env:
KODE_SKIP_BINARY_DOWNLOAD: "1"
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '20.18.1'
- name: Setup Bun
uses: oven-sh/setup-bun@v2
with:
bun-version: latest
- name: Install
run: bun install
- name: Set package.json version (dev)
run: node -e "const fs=require('fs');const p=JSON.parse(fs.readFileSync('package.json'));p.version='${{ needs.compute-version.outputs.dev_version }}';fs.writeFileSync('package.json',JSON.stringify(p,null,2)+'\n')"
- name: Build binary
run: bun build src/entrypoints/index.ts --compile --target=${{ matrix.target }} --format=esm --outfile=${{ matrix.asset }}
- name: Make binary executable
if: runner.os != 'Windows'
run: chmod +x ${{ matrix.asset }}
- name: Upload binary artifact
uses: actions/upload-artifact@v4
with:
name: ${{ matrix.asset }}
path: ${{ matrix.asset }}
if-no-files-found: error
prerelease:
needs: [compute-version, build-binaries]
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Download binary artifacts
uses: actions/download-artifact@v4
with:
path: artifacts
- name: Create checksums
run: |
find artifacts -type f -maxdepth 2 -print0 | sort -z | xargs -0 shasum -a 256 > checksums-sha256.txt
echo "Checksums:"
head -n 20 checksums-sha256.txt
- name: Create GitHub prerelease
uses: softprops/action-gh-release@v2
with:
tag_name: ${{ needs.compute-version.outputs.tag_name }}
name: ${{ needs.compute-version.outputs.tag_name }}
prerelease: true
files: |
artifacts/**/*
checksums-sha256.txt