-
Notifications
You must be signed in to change notification settings - Fork 0
85 lines (80 loc) · 2.59 KB
/
Copy pathrelease.yml
File metadata and controls
85 lines (80 loc) · 2.59 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
name: Release
on:
push:
tags: ["v*"]
workflow_dispatch:
inputs:
tag:
description: Existing version tag to publish, for example v1.0.0
required: true
type: string
permissions:
contents: write
jobs:
verify:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v7
with:
ref: ${{ github.event_name == 'workflow_dispatch' && inputs.tag || github.ref }}
- uses: oven-sh/setup-bun@v2
with:
bun-version: 1.3.3
- run: bun install --frozen-lockfile
- run: bun run check
- name: Verify release version
run: bun run version:check "${{ github.event_name == 'workflow_dispatch' && inputs.tag || github.ref_name }}"
build:
needs: verify
strategy:
fail-fast: false
matrix:
target: [linux-x64, linux-arm64, macos-x64, macos-arm64, windows-x64]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v7
with:
ref: ${{ github.event_name == 'workflow_dispatch' && inputs.tag || github.ref }}
- uses: oven-sh/setup-bun@v2
with:
bun-version: 1.3.3
- run: bun install --frozen-lockfile
- name: Compile ${{ matrix.target }}
run: bun run build --target=${{ matrix.target }}
- name: Package binary
run: |
binary="codex-proxy-${{ matrix.target }}"
if [[ "${{ matrix.target }}" == windows-* ]]; then
binary="${binary}.exe"
fi
tar -C dist -czf codex-proxy-${{ matrix.target }}.tar.gz "$binary"
- uses: actions/upload-artifact@v7
with:
name: release-${{ matrix.target }}
path: codex-proxy-${{ matrix.target }}.tar.gz
if-no-files-found: error
publish:
needs: build
runs-on: ubuntu-latest
env:
GH_TOKEN: ${{ github.token }}
RELEASE_TAG: ${{ github.event_name == 'workflow_dispatch' && inputs.tag || github.ref_name }}
steps:
- uses: actions/checkout@v7
with:
fetch-depth: 0
- uses: actions/download-artifact@v8
with:
pattern: release-*
merge-multiple: true
path: release-assets
- name: Generate checksums
working-directory: release-assets
run: sha256sum *.tar.gz > SHA256SUMS
- name: Create or update GitHub release
run: |
if gh release view "$RELEASE_TAG" >/dev/null 2>&1; then
gh release upload "$RELEASE_TAG" release-assets/* --clobber
else
gh release create "$RELEASE_TAG" release-assets/* --verify-tag --generate-notes --title "$RELEASE_TAG"
fi