Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 17 additions & 3 deletions .github/workflows/opencode-smoke.yml
Original file line number Diff line number Diff line change
Expand Up @@ -87,12 +87,26 @@ jobs:
echo "spec=opencode-synced@$VERSION" >> "$GITHUB_OUTPUT"
echo "version=$VERSION" >> "$GITHUB_OUTPUT"

- name: Resolve OpenCode version
id: opencode-version
env:
GH_TOKEN: ${{ github.token }}
run: |
set -euo pipefail
OPENCODE_VERSION=$(gh api repos/anomalyco/opencode/releases/latest --jq '.tag_name')
if [[ ! "$OPENCODE_VERSION" =~ ^v[0-9]+\.[0-9]+\.[0-9]+([.-][0-9A-Za-z.-]+)?$ ]]; then
echo "[ERROR] Invalid OpenCode release version: $OPENCODE_VERSION"
exit 1
fi
echo "version=$OPENCODE_VERSION" >> "$GITHUB_OUTPUT"

- name: Install opencode
env:
opencode_install_dir: ${{ runner.temp }}/opencode/bin
OPENCODE_VERSION: ${{ steps.opencode-version.outputs.version }}
run: |
curl -fsSL https://opencode.ai/install | bash
echo "${opencode_install_dir}" >> "$GITHUB_PATH"
set -euo pipefail
curl -fsSL --retry 3 --retry-all-errors https://opencode.ai/install |
bash -s -- --version "$OPENCODE_VERSION" --no-modify-path

- name: Configure clean opencode home
env:
Expand Down
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,10 @@ All notable changes to this project will be documented here by Release Please.

* Pin the remaining GitHub Actions to immutable commits ([#82](https://github.com/iHildy/opencode-synced/pull/82)).

### Release Reliability

* Authenticate OpenCode version lookup in the macOS prepublish smoke without exposing the token to its installer ([#87](https://github.com/iHildy/opencode-synced/pull/87)).

### Documentation

* Explain v1/v2 requirements, configuration keys, and the Node shell shim ([#84](https://github.com/iHildy/opencode-synced/pull/84)).
Expand Down
12 changes: 12 additions & 0 deletions src/release-workflows.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,18 @@ describe('release workflows', () => {
expect(smokeWorkflow).toContain('Expected exact version $REQUESTED_VERSION');
});

it('keeps the GitHub token out of the external OpenCode installer step', () => {
expect(smokeWorkflow).toContain('GH_TOKEN: $' + '{{ github.token }}');
expect(smokeWorkflow).toContain(
"gh api repos/anomalyco/opencode/releases/latest --jq '.tag_name'"
);
expect(smokeWorkflow).toContain(
'OPENCODE_VERSION: $' + '{{ steps.opencode-version.outputs.version }}'
);
expect(smokeWorkflow).toContain('bash -s -- --version "$OPENCODE_VERSION" --no-modify-path');
expect(smokeWorkflow).not.toContain('curl -fsSL https://opencode.ai/install | bash');
});

it('uses string comparisons for release-please boolean outputs and frozen setup', () => {
expect(releaseWorkflow).toContain("outputs.releases_created == 'true'");
expect(releaseWorkflow).toContain("outputs.prs_created == 'true'");
Expand Down
Loading