chore: bump to v0.5.11 #21
Workflow file for this run
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 and Publish | |
| on: | |
| push: | |
| tags: | |
| - "v*" | |
| permissions: | |
| contents: write | |
| id-token: write | |
| jobs: | |
| release-and-publish: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| - name: Get tag name | |
| id: tag | |
| run: echo "tag=${GITHUB_REF#refs/tags/}" >> $GITHUB_OUTPUT | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: "22" | |
| - name: Upgrade npm to v11+ for OIDC support | |
| run: npm install -g npm@latest | |
| - name: Setup Bun | |
| uses: oven-sh/setup-bun@v2 | |
| with: | |
| bun-version: "1.1.29" | |
| - name: Install dependencies | |
| run: bun install | |
| - name: Build | |
| run: bun run build | |
| - name: Publish to NPM with OIDC Trusted Publishing | |
| run: npm publish --access public | |
| - name: Generate changelog | |
| id: changelog | |
| run: | | |
| PREVIOUS_TAG=$(git describe --abbrev=0 --tags $(git rev-list --tags --skip=1 --max-count=1) 2>/dev/null || echo "") | |
| if [ -z "$PREVIOUS_TAG" ]; then | |
| cat > CHANGELOG.md << 'CHANGELOG_EOF' | |
| ## Initial Release | |
| CLI tool for tracking OpenCode AI coding assistant usage and costs. | |
| ### Features | |
| - Daily usage breakdown with token counts and estimated costs | |
| - Provider breakdown (Anthropic, OpenAI, Google, etc.) | |
| - Filter by provider or time range | |
| - Works with both Node.js and Bun | |
| ### Installation | |
| ```bash | |
| npx opencode-usage | |
| bunx opencode-usage | |
| ``` | |
| See README.md for full documentation. | |
| CHANGELOG_EOF | |
| else | |
| echo "## What's Changed" > CHANGELOG.md | |
| echo "" >> CHANGELOG.md | |
| git log --pretty=format:"- %s (%h)" $PREVIOUS_TAG..HEAD >> CHANGELOG.md | |
| echo "" >> CHANGELOG.md | |
| echo "" >> CHANGELOG.md | |
| echo "**Full Changelog**: https://github.com/gaboe/opencode-usage/compare/${PREVIOUS_TAG}...${{ steps.tag.outputs.tag }}" >> CHANGELOG.md | |
| fi | |
| echo "changelog<<EOF" >> $GITHUB_OUTPUT | |
| cat CHANGELOG.md >> $GITHUB_OUTPUT | |
| echo "EOF" >> $GITHUB_OUTPUT | |
| - name: Create GitHub Release | |
| uses: softprops/action-gh-release@v2 | |
| with: | |
| tag_name: ${{ steps.tag.outputs.tag }} | |
| name: Release ${{ steps.tag.outputs.tag }} | |
| body: ${{ steps.changelog.outputs.changelog }} | |
| draft: false | |
| prerelease: false | |
| generate_release_notes: true | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |