Repository navigation
72 lines (62 loc) · 2.15 KB
/
Copy pathrelease.yml
File metadata and controls
72 lines (62 loc) · 2.15 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
name: release
on:
push:
branches:
- dev
workflow_dispatch:
inputs:
version:
description: "Release version override (e.g. 1.18.31); defaults to next patch from latest tag"
required: false
type: string
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: false
permissions:
contents: write
jobs:
release:
runs-on: ubuntu-latest
env:
GH_TOKEN: ${{ github.token }}
GH_REPO: ${{ github.repository }}
steps:
- uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4.3.1
with:
fetch-depth: 0
fetch-tags: true
- uses: ./.github/actions/setup-bun
- name: Compute next version
id: version
env:
VERSION_INPUT: ${{ inputs.version }}
run: |
if [ -n "$VERSION_INPUT" ]; then
version="${VERSION_INPUT#v}"
else
latest_tag=$(git tag --list 'v*' --sort=-v:refname | head -n1)
if [ -n "$latest_tag" ]; then
IFS='.' read -r major minor patch <<< "${latest_tag#v}"
version="$major.$minor.$((patch + 1))"
else
version=$(bun -e 'console.log(JSON.parse(await Bun.file("packages/opencode/package.json").text()).version)')
fi
fi
echo "version=$version" >> "$GITHUB_OUTPUT"
echo "tag=v$version" >> "$GITHUB_OUTPUT"
- name: Create draft release
run: |
tag="${{ steps.version.outputs.tag }}"
if ! gh release view "$tag" > /dev/null 2>&1; then
gh release create "$tag" --draft --target "$GITHUB_SHA" --title "$tag" --generate-notes
fi
- name: Build binaries and upload to release
run: ./packages/opencode/script/build.ts
env:
OPENCODE_VERSION: ${{ steps.version.outputs.version }}
OPENCODE_RELEASE: "1"
OPENCODE_CHANNEL: latest
- name: Attach install script
run: gh release upload "${{ steps.version.outputs.tag }}" install --clobber
- name: Publish release
run: gh release edit "${{ steps.version.outputs.tag }}" --draft=false