GeezerVison is showing github.com — feat: add caching for opencode binary in GitHub Actions (#5384) · maximkr/opencode@0efdc3a
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/action.yml +19Lines changed: 19 additions & 0 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -20,10 +20,29 @@ inputs: |
20 | 20 | runs: |
21 | 21 | using: "composite" |
22 | 22 | steps: |
| 23 | + - name: Get opencode version |
| 24 | + id: version |
| 25 | + shell: bash |
| 26 | + run: | |
| 27 | + VERSION=$(curl -sf https://api.github.com/repos/sst/opencode/releases/latest | grep -o '"tag_name": *"[^"]*"' | cut -d'"' -f4) |
| 28 | + echo "version=${VERSION:-latest}" >> $GITHUB_OUTPUT |
| 29 | +
|
| 30 | + - name: Cache opencode |
| 31 | + id: cache |
| 32 | + uses: actions/cache@v4 |
| 33 | + with: |
| 34 | + path: ~/.opencode/bin |
| 35 | + key: opencode-${{ runner.os }}-${{ runner.arch }}-${{ steps.version.outputs.version }} |
| 36 | + |
23 | 37 | - name: Install opencode |
| 38 | + if: steps.cache.outputs.cache-hit != 'true' |
24 | 39 | shell: bash |
25 | 40 | run: curl -fsSL https://opencode.ai/install | bash |
26 | 41 |
|
| 42 | + - name: Add opencode to PATH |
| 43 | + shell: bash |
| 44 | + run: echo "$HOME/.opencode/bin" >> $GITHUB_PATH |
| 45 | + |
27 | 46 | - name: Run opencode |
28 | 47 | shell: bash |
29 | 48 | id: run_opencode |
|