This repository was archived by the owner on Feb 28, 2026. It is now read-only.
fix: bump user-agent to 1.15.8 and detect OS/arch dynamically (#34) #49
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Release | |
| on: | |
| push: | |
| branches: | |
| - main | |
| workflow_dispatch: | |
| permissions: | |
| contents: write | |
| id-token: write | |
| jobs: | |
| publish: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| - name: Use Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: 20 | |
| - name: Determine release state | |
| id: determine | |
| run: | | |
| set -euo pipefail | |
| CURRENT_VERSION=$(node -p "require('./package.json').version") | |
| echo "current_version=$CURRENT_VERSION" >> "$GITHUB_OUTPUT" | |
| if git rev-parse HEAD^ >/dev/null 2>&1; then | |
| PREVIOUS_VERSION=$(node -e "const { execSync } = require('node:child_process'); try { const data = execSync('git show HEAD^:package.json', { stdio: ['ignore', 'pipe', 'ignore'] }); const json = JSON.parse(data.toString()); if (json && typeof json.version === 'string') { process.stdout.write(json.version); } } catch (error) {}") | |
| PREVIOUS_VERSION=${PREVIOUS_VERSION//$'\n'/} | |
| else | |
| PREVIOUS_VERSION="" | |
| fi | |
| echo "previous_version=$PREVIOUS_VERSION" >> "$GITHUB_OUTPUT" | |
| if [ "$CURRENT_VERSION" = "$PREVIOUS_VERSION" ]; then | |
| echo "changed=false" >> "$GITHUB_OUTPUT" | |
| else | |
| echo "changed=true" >> "$GITHUB_OUTPUT" | |
| fi | |
| git fetch --tags --force | |
| if git tag -l "v$CURRENT_VERSION" | grep -q "v$CURRENT_VERSION"; then | |
| echo "tag_exists=true" >> "$GITHUB_OUTPUT" | |
| else | |
| echo "tag_exists=false" >> "$GITHUB_OUTPUT" | |
| fi | |
| - name: Install dependencies | |
| if: steps.determine.outputs.changed == 'true' && steps.determine.outputs.tag_exists == 'false' | |
| run: | | |
| npm install -g npm@latest | |
| npm install | |
| - name: Generate release notes | |
| if: steps.determine.outputs.changed == 'true' && steps.determine.outputs.tag_exists == 'false' | |
| id: release_notes | |
| run: | | |
| set -euo pipefail | |
| CURRENT_VERSION="${{ steps.determine.outputs.current_version }}" | |
| PREVIOUS_VERSION="${{ steps.determine.outputs.previous_version }}" | |
| RANGE="" | |
| COMPARE_URL="" | |
| LAST_TAG=$(git describe --tags --abbrev=0 HEAD^ 2>/dev/null || true) | |
| if [ -z "$LAST_TAG" ] && [ -n "$PREVIOUS_VERSION" ] && git rev-parse "refs/tags/v${PREVIOUS_VERSION}" >/dev/null 2>&1; then | |
| LAST_TAG="v${PREVIOUS_VERSION}" | |
| fi | |
| if [ -n "$LAST_TAG" ]; then | |
| RANGE="${LAST_TAG}..HEAD" | |
| COMPARE_URL="https://github.com/${GITHUB_REPOSITORY}/compare/${LAST_TAG}...v${CURRENT_VERSION}" | |
| fi | |
| if [ -n "$RANGE" ]; then | |
| CHANGELOG=$(git log --no-merges --pretty=format:'- %s (%h)' "$RANGE") | |
| else | |
| CHANGELOG=$(git log --no-merges --pretty=format:'- %s (%h)') | |
| fi | |
| if [ -z "$CHANGELOG" ]; then | |
| CHANGELOG="- No commits found for this release." | |
| fi | |
| BODY_FILE=$(mktemp) | |
| { | |
| echo "## Release v${CURRENT_VERSION}" | |
| echo "" | |
| if [ -n "$COMPARE_URL" ]; then | |
| echo "Compare changes: $COMPARE_URL" | |
| echo "" | |
| fi | |
| printf "%s\n" "$CHANGELOG" | |
| echo "" | |
| echo "### Update Instructions" | |
| echo "" | |
| echo "To get the latest version:" | |
| echo "" | |
| printf '%s\n' '```bash' | |
| printf '%s\n' '(cd ~ && sed -i.bak '\''/"opencode-google-antigravity-auth"/d'\'' .cache/opencode/package.json && \' | |
| printf '%s\n' 'rm -rf .cache/opencode/node_modules/opencode-google-antigravity-auth && \' | |
| printf '%s\n' 'echo "Plugin update script finished successfully.")' | |
| printf '%s\n' '```' | |
| } >"$BODY_FILE" | |
| cat "$BODY_FILE" | |
| { | |
| echo "body<<EOF" | |
| cat "$BODY_FILE" | |
| echo "EOF" | |
| } >>"$GITHUB_OUTPUT" | |
| - name: Create GitHub release | |
| if: steps.determine.outputs.changed == 'true' && steps.determine.outputs.tag_exists == 'false' | |
| uses: actions/create-release@v1 | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| with: | |
| tag_name: v${{ steps.determine.outputs.current_version }} | |
| release_name: v${{ steps.determine.outputs.current_version }} | |
| body: ${{ steps.release_notes.outputs.body }} | |
| generate_release_notes: false | |
| - name: Publish to npm | |
| if: steps.determine.outputs.changed == 'true' && steps.determine.outputs.tag_exists == 'false' | |
| run: | | |
| npm publish --access public --provenance |