Something went wrong. Try again.
npx ccusage
Something went wrong. Try again.
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173name: tagpr
on: push: branches: - main # Toggling tagpr:minor / tagpr:major labels on the release PR should update # its proposed version right away, instead of waiting for the next push to # main to make tagpr recompute it. pull_request: types: - labeled - unlabeled workflow_dispatch:
concurrency: tagpr
jobs: tagpr: # Label events only matter on tagpr's own release PR; skip the rest so # ordinary PR labeling doesn't spend runner time. if: github.event_name != 'pull_request' || startsWith(github.head_ref, 'tagpr-from-') runs-on: blacksmith-32vcpu-ubuntu-2404 timeout-minutes: 15 permissions: contents: write pull-requests: write issues: read outputs: tag: ${{ steps.tagpr.outputs.tag }} steps: # persist-credentials stays on (default) so tagpr can push the release PR and tag # ref: main because on pull_request events the default checkout is the # PR merge ref, while tagpr always operates on the release branch. - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 with: ref: main fetch-depth: 0 - id: tagpr uses: Songmu/tagpr@d1b8138b7a31075141b6cd64103de9485ced7ac9 # v1.20.1 env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# The release jobs below run in this workflow instead of a tag-triggered one # because tags pushed with GITHUB_TOKEN do not trigger `on: push: tags` # workflows. They run only when tagpr just tagged a release-PR merge, and # check out that tag explicitly. To retry a failed release, re-run only the # failed jobs: a full re-run finds no new tag and skips everything. build-native-packages: name: ${{ matrix.name }} needs: tagpr if: needs.tagpr.outputs.tag != '' runs-on: ${{ matrix.os }} timeout-minutes: 30 strategy: fail-fast: false matrix: include: - name: build-linux-arm64 os: blacksmith-32vcpu-ubuntu-2404-arm platform: linux arch: arm64 binary: result/bin/ccusage - name: build-linux-x64 os: blacksmith-32vcpu-ubuntu-2404 platform: linux arch: x64 binary: result/bin/ccusage - name: build-mac-arm64 os: blacksmith-12vcpu-macos-26 platform: darwin arch: arm64 binary: result/bin/ccusage - name: build-mac-x64 os: blacksmith-12vcpu-macos-26 platform: darwin arch: x64 binary: result/bin/ccusage - name: build-windows-arm64 os: windows-11-arm platform: win32 arch: arm64 binary: rust/target/release/ccusage.exe - name: build-windows-x64 os: blacksmith-32vcpu-windows-2025 platform: win32 arch: x64 binary: rust/target/release/ccusage.exe
steps: - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 with: ref: ${{ needs.tagpr.outputs.tag }} fetch-depth: 0 persist-credentials: false - uses: ./.github/actions/build-linux-native-package if: matrix.platform == 'linux' with: arch: ${{ matrix.arch }} binary: ${{ matrix.binary }} cache-scope: ${{ matrix.name }} - uses: ./.github/actions/build-macos-nix-native-package if: matrix.platform == 'darwin' with: arch: ${{ matrix.arch }} binary: ${{ matrix.binary }} cache-scope: ${{ matrix.name }} - uses: ./.github/actions/build-windows-native-package if: matrix.platform == 'win32' with: arch: ${{ matrix.arch }} binary: ${{ matrix.binary }}
npm: needs: - tagpr - build-native-packages if: needs.tagpr.outputs.tag != '' runs-on: ubuntu-24.04-arm timeout-minutes: 10 permissions: contents: read id-token: write steps: - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 with: ref: ${{ needs.tagpr.outputs.tag }} fetch-depth: 0 persist-credentials: false - uses: ./.github/actions/setup-nix-cache - uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v7.0.0 with: registry-url: 'https://registry.npmjs.org' node-version: lts/* package-manager-cache: false # node comes from setup-node above (needed for the npm registry auth); # Nushell package checks bring Nu through their Nix shebangs. `publint` is # the flake's own pinned build, invoked by every package's prepack script. - run: nix profile install --inputs-from . nixpkgs#pnpm .#publint - run: pnpm install --frozen-lockfile - uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1 with: pattern: ccusage-native-* path: ${{ runner.temp }}/native-packages merge-multiple: true - name: Restore native package binaries run: | for archive in "$RUNNER_TEMP"/native-packages/*.tar; do tar -xf "$archive" done - run: pnpm --filter='./apps/ccusage' --filter='./packages/ccusage-*' publish --provenance --no-git-checks --access public
release: needs: - tagpr - npm if: needs.tagpr.outputs.tag != '' runs-on: blacksmith-32vcpu-ubuntu-2404 permissions: contents: write steps: # changelogithub resolves the release tag with `git tag --points-at HEAD`, # so checking out the tag is what makes it pick the right release - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 with: ref: ${{ needs.tagpr.outputs.tag }} fetch-depth: 0 persist-credentials: false - uses: ./.github/actions/setup-nix-cache - run: nix run .#changelogithub env: GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}