GeezerVison is showing github.com — ci: bump version · karnagge/codechico@1437a0a
File tree
Expand file treeCollapse file tree
Open diff view settings
Expand file treeCollapse file tree
Open diff view settings
Collapse file
Copy file name to clipboardExpand all lines: .github/workflows/format.yml +4-5Lines changed: 4 additions & 5 deletions | Original file line number | Diff line number | Diff line change |
|---|
|
20 | 20 | with: |
21 | 21 | bun-version: 1.2.21 |
22 | 22 |
|
23 | | - - name: Install dependencies |
24 | | - run: bun install |
25 | | - |
26 | | - - name: Run format |
27 | | - run: ./script/format.ts |
| 23 | + - name: run |
| 24 | + run: | |
| 25 | + bun install |
| 26 | + ./script/format.ts |
28 | 27 | env: |
29 | 28 | CI: true |
Collapse file
Copy file name to clipboardExpand all lines: .github/workflows/publish.yml +9-8Lines changed: 9 additions & 8 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -4,14 +4,14 @@ run-name: "${{ format('v{0}', inputs.version) }}" |
4 | 4 | on: |
5 | 5 | workflow_dispatch: |
6 | 6 | inputs: |
7 | | - version: |
8 | | - description: "Version to publish" |
| 7 | + bump: |
| 8 | + description: "Bump major, minor, or patch" |
9 | 9 | required: true |
10 | | - type: string |
11 | | - title: |
12 | | - description: "Custom title for this run" |
13 | | - required: false |
14 | | - type: string |
| 10 | + type: choice |
| 11 | + options: |
| 12 | + - major |
| 13 | + - minor |
| 14 | + - patch |
15 | 15 |
|
16 | 16 | concurrency: ${{ github.workflow }}-${{ github.ref }} |
17 | 17 |
|
|
65 | 65 |
|
66 | 66 | - name: Publish |
67 | 67 | run: | |
68 | | - OPENCODE_VERSION=${{ inputs.version }} ./script/publish.ts |
| 68 | + ./script/publish.ts |
69 | 69 | env: |
| 70 | + OPENCODE_BUMP: ${{ inputs.bump }} |
70 | 71 | GITHUB_TOKEN: ${{ secrets.SST_GITHUB_TOKEN }} |
71 | 72 | AUR_KEY: ${{ secrets.AUR_KEY }} |
72 | 73 | NPM_CONFIG_TOKEN: ${{ secrets.NPM_TOKEN }} |
Collapse file
Copy file name to clipboardExpand all lines: script/publish.ts +12-6Lines changed: 12 additions & 6 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -9,12 +9,18 @@ if (process.versions.bun !== "1.2.21") { |
9 | 9 | console.log("=== publishing ===\n") |
10 | 10 |
|
11 | 11 | const snapshot = process.env["OPENCODE_SNAPSHOT"] === "true" |
12 | | -const version = snapshot |
13 | | - ? `0.0.0-${new Date().toISOString().slice(0, 16).replace(/[-:T]/g, "")}` |
14 | | - : process.env["OPENCODE_VERSION"] |
15 | | -if (!version) { |
16 | | - throw new Error("OPENCODE_VERSION is required") |
17 | | -} |
| 12 | +const version = await (async () => { |
| 13 | + if (snapshot) return `0.0.0-${new Date().toISOString().slice(0, 16).replace(/[-:T]/g, "")}` |
| 14 | + const [major, minor, patch] = (await $`gh release list --limit 1 --json tagName --jq '.[0].tagName'`.text()) |
| 15 | + .trim() |
| 16 | + .replace(/^v/, "") |
| 17 | + .split(".") |
| 18 | + .map((x) => Number(x) || 0) |
| 19 | + const t = process.env["OPENCODE_BUMP"]?.toLowerCase() |
| 20 | + if (t === "major") return `${major + 1}.0.0` |
| 21 | + if (t === "minor") return `${major}.${minor + 1}.0` |
| 22 | + return `${major}.${minor}.${patch + 1}` |
| 23 | +})() |
18 | 24 | process.env["OPENCODE_VERSION"] = version |
19 | 25 | console.log("version:", version) |
20 | 26 |
|
|