GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — ci: snapshot builds · steipete/opencode@288c977

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
  • .github/workflows
    • snapshot.yml
  • packages/opencode/script
    • publish.ts
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎.github/workflows/snapshot.yml‎

Copy file name to clipboard
+50Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
name: snapshot
2+
3+
on:
4+
push:
5+
branches:
6+
- dev
7+
- opentui
8+
9+
concurrency: ${{ github.workflow }}-${{ github.ref }}
10+
11+
jobs:
12+
publish:
13+
runs-on: ubuntu-latest
14+
steps:
15+
- uses: actions/checkout@v3
16+
with:
17+
fetch-depth: 0
18+
19+
- run: git fetch --force --tags
20+
21+
- uses: actions/setup-go@v5
22+
with:
23+
go-version: ">=1.24.0"
24+
cache: true
25+
cache-dependency-path: go.sum
26+
27+
- uses: oven-sh/setup-bun@v2
28+
with:
29+
bun-version: 1.2.21
30+
31+
- name: Cache ~/.bun
32+
id: cache-bun
33+
uses: actions/cache@v3
34+
with:
35+
path: ~/.bun
36+
key: ${{ runner.os }}-bun-1-2-21-${{ hashFiles('bun.lock') }}
37+
restore-keys: |
38+
${{ runner.os }}-bun-1-2-21-
39+
40+
- name: Install dependencies
41+
run: bun install
42+
43+
- name: Publish
44+
run: |
45+
./packages/opencode/script/publish.ts
46+
env:
47+
OPENCODE_SNAPSHOT: true
48+
OPENCODE_TAG: ${{ github.ref_name }}
49+
GITHUB_TOKEN: ${{ secrets.SST_GITHUB_TOKEN }}
50+
NPM_CONFIG_TOKEN: ${{ secrets.NPM_TOKEN }}
Collapse file

‎packages/opencode/script/publish.ts‎

Copy file name to clipboardExpand all lines: packages/opencode/script/publish.ts
+12-10Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,14 @@ import { $ } from "bun"
55

66
import pkg from "../package.json"
77

8-
const dry = process.env["OPENCODE_DRY"] === "true"
9-
const version = process.env["OPENCODE_VERSION"]!
108
const snapshot = process.env["OPENCODE_SNAPSHOT"] === "true"
11-
const npmTag = snapshot ? "snapshot" : "latest"
9+
let version = process.env["OPENCODE_VERSION"]
10+
const tag = process.env["OPENCODE_TAG"] ?? (snapshot ? "snapshot" : "latest")
11+
if (!version && snapshot) {
12+
version = `0.0.0-${tag}-${new Date().toISOString().slice(0, 16).replace(/[-:T]/g, "")}`
13+
process.env["OPENCODE_VERSION"] = version
14+
}
15+
if (!version) throw new Error("OPENCODE_VERSION is required")
1216

1317
console.log(`publishing ${version}`)
1418

@@ -41,12 +45,10 @@ await Bun.file(`./dist/${pkg.name}/package.json`).write(
4145
2,
4246
),
4347
)
44-
if (!dry) {
45-
for (const [name] of Object.entries(binaries)) {
46-
await $`cd dist/${name} && chmod 777 -R . && bun publish --access public --tag ${npmTag}`
47-
}
48-
await $`cd ./dist/${pkg.name} && bun publish --access public --tag ${npmTag}`
48+
for (const [name] of Object.entries(binaries)) {
49+
await $`cd dist/${name} && chmod 777 -R . && bun publish --access public --tag ${tag}`
4950
}
51+
await $`cd ./dist/${pkg.name} && bun publish --access public --tag ${tag}`
5052

5153
if (!snapshot) {
5254
for (const key of Object.keys(binaries)) {
@@ -142,7 +144,7 @@ if (!snapshot) {
142144
await $`cd ./dist/aur-${pkg} && makepkg --printsrcinfo > .SRCINFO`
143145
await $`cd ./dist/aur-${pkg} && git add PKGBUILD .SRCINFO`
144146
await $`cd ./dist/aur-${pkg} && git commit -m "Update to v${version}"`
145-
if (!dry) await $`cd ./dist/aur-${pkg} && git push`
147+
await $`cd ./dist/aur-${pkg} && git push`
146148
}
147149

148150
// Homebrew formula
@@ -201,5 +203,5 @@ if (!snapshot) {
201203
await Bun.file("./dist/homebrew-tap/opencode.rb").write(homebrewFormula)
202204
await $`cd ./dist/homebrew-tap && git add opencode.rb`
203205
await $`cd ./dist/homebrew-tap && git commit -m "Update to v${version}"`
204-
if (!dry) await $`cd ./dist/homebrew-tap && git push`
206+
await $`cd ./dist/homebrew-tap && git push`
205207
}

0 commit comments

Comments
0 (0)
You are visitor 01402792 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.