-
Notifications
You must be signed in to change notification settings - Fork 232
80 lines (70 loc) · 2.56 KB
/
publish.yml
File metadata and controls
80 lines (70 loc) · 2.56 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
name: publish
on:
workflow_dispatch:
inputs:
tag:
description: "npm dist-tag (default: latest)"
required: false
type: string
dry_run:
description: "Dry run (no publish)"
required: false
default: false
type: boolean
release:
types: [published]
concurrency: ${{ github.workflow }}-${{ github.ref }}
permissions:
contents: write
packages: write
jobs:
publish:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Read Bun version from package.json
id: bun-version
run: echo "version=$(jq -r '.engines.bun' package.json)" >> $GITHUB_OUTPUT
- name: Setup Bun
uses: oven-sh/setup-bun@v1
with:
bun-version: ${{ steps.bun-version.outputs.version }}
- name: Install dependencies
run: bun install --frozen-lockfile
- name: Publish packages
env:
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
NPM_TAG: ${{ github.event_name == 'workflow_dispatch' && github.event.inputs.tag || '' }}
DRY_RUN: ${{ github.event_name == 'workflow_dispatch' && github.event.inputs.dry_run || '' }}
run: |
TAG=${NPM_TAG:-latest}
CMD="bun scripts/publish.ts --tag ${TAG}"
if [ "${DRY_RUN}" = "true" ]; then
CMD="${CMD} --dry-run"
fi
echo "Running: ${CMD}"
${CMD}
- name: Upload binaries to GitHub Release
if: github.event_name == 'release' || github.event_name == 'workflow_dispatch'
env:
GH_TOKEN: ${{ github.token }}
run: |
# Get the tag name (from release event or ref)
TAG_NAME="${{ github.event.release.tag_name || github.ref_name }}"
# Rename binaries to match expected download names
cp binaries/codemachine-linux-x64/codemachine codemachine-linux-x64
cp binaries/codemachine-linux-arm64/codemachine codemachine-linux-arm64
cp binaries/codemachine-darwin-arm64/codemachine codemachine-darwin-arm64
cp binaries/codemachine-darwin-x64/codemachine codemachine-darwin-x64
cp binaries/codemachine-windows-x64/codemachine.exe codemachine-windows-x64.exe
# Upload to release
gh release upload "$TAG_NAME" \
codemachine-linux-x64 \
codemachine-linux-arm64 \
codemachine-darwin-arm64 \
codemachine-darwin-x64 \
codemachine-windows-x64.exe \
--clobber