Build Offline Bundle #21
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: Build Offline Bundle | |
| on: | |
| workflow_dispatch: | |
| permissions: | |
| contents: write | |
| jobs: | |
| build: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| - name: Calculate next version | |
| id: version | |
| run: | | |
| git fetch --tags | |
| # Get the highest existing version tag (offline-v*) | |
| latest=$(git tag -l 'offline-v*' | sed 's/offline-v//' | sort -n | tail -1) | |
| if [ -z "$latest" ]; then | |
| next=1 | |
| else | |
| next=$((latest + 1)) | |
| fi | |
| # Get short commit SHA (7 chars) | |
| sha=$(git rev-parse --short=7 HEAD) | |
| echo "version=$next" >> $GITHUB_OUTPUT | |
| echo "tag=offline-v$next" >> $GITHUB_OUTPUT | |
| echo "sha=$sha" >> $GITHUB_OUTPUT | |
| echo "Calculated version: $next (tag: offline-v$next, sha: $sha)" | |
| - uses: oven-sh/setup-bun@v1 | |
| with: | |
| bun-version: "1.3.5" | |
| - name: Install dependencies | |
| run: bun install | |
| - name: Download offline dependencies | |
| run: bun run script/download-offline-deps.ts | |
| - name: Build and package bundle | |
| run: bun run script/package-offline-bundle.ts | |
| env: | |
| BUNDLE_VERSION: ${{ steps.version.outputs.version }} | |
| BUNDLE_COMMIT_SHA: ${{ steps.version.outputs.sha }} | |
| - name: Upload artifact | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: opencode-offline-linux-x64-${{ steps.version.outputs.version }} | |
| path: dist/opencode-offline-linux-x64.tar.gz | |
| retention-days: 30 | |
| - name: Create version tag | |
| run: | | |
| git config user.name "github-actions[bot]" | |
| git config user.email "github-actions[bot]@users.noreply.github.com" | |
| git tag ${{ steps.version.outputs.tag }} | |
| git push origin ${{ steps.version.outputs.tag }} | |
| - name: Summary | |
| run: | | |
| echo "## Offline Bundle Created" >> $GITHUB_STEP_SUMMARY | |
| echo "" >> $GITHUB_STEP_SUMMARY | |
| echo "**Version:** ${{ steps.version.outputs.version }}" >> $GITHUB_STEP_SUMMARY | |
| echo "" >> $GITHUB_STEP_SUMMARY | |
| echo "**Tag:** \`${{ steps.version.outputs.tag }}\`" >> $GITHUB_STEP_SUMMARY | |
| echo "" >> $GITHUB_STEP_SUMMARY | |
| echo "### Bundle Contents" >> $GITHUB_STEP_SUMMARY | |
| echo "\`\`\`" >> $GITHUB_STEP_SUMMARY | |
| tar -tzf dist/opencode-offline-linux-x64.tar.gz | head -50 >> $GITHUB_STEP_SUMMARY | |
| echo "..." >> $GITHUB_STEP_SUMMARY | |
| echo "\`\`\`" >> $GITHUB_STEP_SUMMARY | |
| echo "" >> $GITHUB_STEP_SUMMARY | |
| echo "### Manifest" >> $GITHUB_STEP_SUMMARY | |
| echo "\`\`\`json" >> $GITHUB_STEP_SUMMARY | |
| cat dist/opencode-offline-linux-x64/manifest.json >> $GITHUB_STEP_SUMMARY | |
| echo "\`\`\`" >> $GITHUB_STEP_SUMMARY | |
| echo "" >> $GITHUB_STEP_SUMMARY | |
| echo "**Size:** $(du -h dist/opencode-offline-linux-x64.tar.gz | cut -f1)" >> $GITHUB_STEP_SUMMARY |