jira-cli 0.4.12

Agent-friendly Jira CLI with JSON output, structured exit codes, and schema introspection
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
name: Release

on:
  push:
    tags:
      - "v[0-9]*.[0-9]*.[0-9]*"
  workflow_dispatch:
    inputs:
      version:
        description: "Version to rehearse (defaults to Cargo.toml)"
        required: false
        type: string
      dry_run:
        description: 'Dry run (skip publishing)'
        required: false
        default: true
        type: boolean
      skip_crates_io:
        description: 'Skip crates.io publish'
        required: false
        default: false
        type: boolean
      skip_pypi:
        description: 'Skip PyPI publish'
        required: false
        default: false
        type: boolean

permissions:
  contents: read

jobs:
  test:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1
      - name: Validate release metadata
        shell: bash
        env:
          REQUESTED_VERSION: ${{ inputs.version }}
          DRY_RUN: ${{ inputs.dry_run }}
        run: |
          manifest_version=$(grep "^version = \"" Cargo.toml | head -1 | cut -d\" -f2)
          version="${REQUESTED_VERSION#v}"
          version="${version:-$manifest_version}"
          [[ "$version" =~ ^[0-9]+\.[0-9]+\.[0-9]+([+-][0-9A-Za-z.-]+)?$ ]]
          test "$manifest_version" = "$version"
          tag="v${version}"
          if [[ "$GITHUB_EVENT_NAME" == "push" ]]; then
            test "$GITHUB_REF_NAME" = "$tag"
          elif [[ "$DRY_RUN" != "true" ]]; then
            test "$GITHUB_REF_TYPE" = "tag"
            test "$GITHUB_REF_NAME" = "$tag"
          fi
      - uses: dtolnay/rust-toolchain@4360b52568e2003a75bf9bc1d59f33a8e3fc893c
        with:
          toolchain: 1.96.0
          components: rustfmt, clippy
      - uses: taiki-e/install-action@82cd3e7658a6f96c86c0234aeeda1748937cb0a1
        with:
          tool: nextest
      - run: cargo check --locked
      - run: make test

  build:
    needs: test
    timeout-minutes: 60
    # Guard: self-hosted runners only execute on trusted events (tag push,
    # workflow_dispatch). Fork PRs must never dispatch jobs to self-hosted.
    if: github.event_name != 'pull_request'
    strategy:
      matrix:
        include:
          - target: x86_64-unknown-linux-gnu
            os: ubuntu-latest
          - target: aarch64-unknown-linux-gnu
            os: [self-hosted, Linux, ARM64]
          - target: x86_64-apple-darwin
            os: [self-hosted, macOS, ARM64]
          - target: aarch64-apple-darwin
            os: [self-hosted, macOS, ARM64]
    runs-on: ${{ matrix.os }}
    steps:
      - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1
        with:
          # Preserve target/ between runs on self-hosted runners for cargo
          # incremental rebuild. GitHub-hosted runners start clean each job
          # regardless of this setting, so this only affects self-hosted.
          clean: false
      - name: Isolate Cargo cache
        shell: bash
        run: echo "CARGO_HOME=${RUNNER_TEMP}/cargo-home-${GITHUB_RUN_ID}-${{ matrix.target }}" >> "$GITHUB_ENV"
      - uses: dtolnay/rust-toolchain@4360b52568e2003a75bf9bc1d59f33a8e3fc893c
        with:
          toolchain: 1.96.0
          components: rustfmt, clippy
          targets: ${{ matrix.target }}
      - name: Install cargo-zigbuild
        if: matrix.target == 'aarch64-unknown-linux-gnu'
        run: cargo install --locked cargo-zigbuild --version 0.23.2
      - name: Prepare cargo cache dirs (arm64 linux)
        if: matrix.target == 'aarch64-unknown-linux-gnu'
        run: mkdir -p "${RUNNER_TOOL_CACHE}/cargo-cache/registry" "${RUNNER_TOOL_CACHE}/cargo-cache/git"
      - name: Clean stale build outputs
        # Wipe every path the upload-artifact glob below can pick up, so prior
        # runs cannot leak tarballs or wheels into this run's artifact. Both
        # macOS targets share one self-hosted runner, so cross-target leakage
        # is possible too. Self-hosted runners do not clean automatically.
        # On the arm64 linux runner, maturin-action runs as root inside the
        # manylinux container and leaves root-owned files behind; clean via
        # docker so the unprivileged runner user can proceed.
        shell: bash
        run: |
          if [[ "${{ matrix.target }}" == "aarch64-unknown-linux-gnu" ]]; then
            docker run --rm -v "${GITHUB_WORKSPACE}:/io" alpine sh -c \
              'rm -rf /io/dist /io/target/wheels && rm -f /io/jira-cli-*.tar.gz /io/jira-cli-*.tar.gz.sha256'
          else
            rm -rf dist target/wheels
            rm -f jira-cli-*.tar.gz jira-cli-*.tar.gz.sha256
          fi
      - name: Install cross-compilation tools
        # Only needed on GitHub-hosted linux where the arm64 toolchain must
        # be cross-installed. The self-hosted arm64 runner is native.
        if: matrix.target == 'aarch64-unknown-linux-gnu' && runner.arch != 'ARM64'
        run: |
          sudo apt-get update
          sudo apt-get install -y gcc-aarch64-linux-gnu
      - name: Install uv
        uses: astral-sh/setup-uv@20cfd1bf945f4377ade1205e4dbc17946fc9a30d
      - name: Install maturin and zig
        # Install into a shared venv so cargo-zigbuild and maturin both find
        # ziglang without requiring privileged system package installation.
        shell: bash
        run: |
          uv venv "${RUNNER_TEMP}/build-venv"
          uv pip install --python "${RUNNER_TEMP}/build-venv/bin/python" maturin ziglang
          echo "${RUNNER_TEMP}/build-venv/bin" >> "$GITHUB_PATH"
      - name: Build wheel (arm64 linux via maturin-action)
        if: matrix.target == 'aarch64-unknown-linux-gnu'
        uses: PyO3/maturin-action@e83996d129638aa358a18fbd1dfb82f0b0fb5d3b
        with:
          target: aarch64-unknown-linux-gnu
          args: --release --out dist
          manylinux: manylinux_2_28
          # Mount persistent cargo cache into the manylinux container so
          # dependency downloads survive between jobs on the self-hosted
          # runner.
          docker-options: -v ${{ runner.tool_cache }}/cargo-cache/registry:/root/.cargo/registry -v ${{ runner.tool_cache }}/cargo-cache/git:/root/.cargo/git
      - name: Build wheel
        if: matrix.target != 'aarch64-unknown-linux-gnu'
        shell: bash
        run: |
          case "${{ matrix.target }}" in
            *-gnu)
              maturin build --release --target ${{ matrix.target }} --zig --out dist
              ;;
            *)
              maturin build --release --target ${{ matrix.target }} --out dist
              ;;
          esac
      - name: Build binary (arm64 linux via cargo-zigbuild)
        # On the Pi runner build natively with cargo-zigbuild targeting
        # glibc 2.28 for wide distro compatibility. Use a separate target
        # directory so host cargo does not conflict with root-owned files
        # left behind by the maturin-action container build in target/.
        if: matrix.target == 'aarch64-unknown-linux-gnu'
        env:
          CARGO_TARGET_DIR: target-host
        run: cargo zigbuild --release --target aarch64-unknown-linux-gnu.2.28
      - name: Build binary
        if: matrix.target != 'aarch64-unknown-linux-gnu'
        run: cargo build --release --target ${{ matrix.target }}
        env:
          CARGO_TARGET_AARCH64_UNKNOWN_LINUX_GNU_LINKER: aarch64-linux-gnu-gcc
      - name: Verify binary
        if: ${{ !contains(matrix.target, 'aarch64-unknown-linux') }}
        run: ./target/${{ matrix.target }}/release/jira --version
      - name: Package binary
        shell: bash
        run: |
          ARCHIVE_NAME="jira-cli-${{ github.ref_name }}-${{ matrix.target }}"
          if [[ "${{ matrix.target }}" == "aarch64-unknown-linux-gnu" ]]; then
            BIN_PATH="target-host/aarch64-unknown-linux-gnu/release/jira"
          else
            BIN_PATH="target/${{ matrix.target }}/release/jira"
          fi
          mkdir -p "${ARCHIVE_NAME}"
          cp "${BIN_PATH}" "${ARCHIVE_NAME}/"
          tar czf "${ARCHIVE_NAME}.tar.gz" "${ARCHIVE_NAME}"
          shasum -a 256 "${ARCHIVE_NAME}.tar.gz" > "${ARCHIVE_NAME}.tar.gz.sha256"
      - uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a
        with:
          name: release-${{ matrix.target }}
          path: |
            jira-cli-*.tar.gz
            jira-cli-*.tar.gz.sha256
            dist/*.whl

  sdist:
    needs: test
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1
      - uses: astral-sh/setup-uv@20cfd1bf945f4377ade1205e4dbc17946fc9a30d
      - name: Install maturin
        shell: bash
        run: |
          uv venv "${RUNNER_TEMP}/build-venv"
          uv pip install --python "${RUNNER_TEMP}/build-venv/bin/python" maturin
          echo "${RUNNER_TEMP}/build-venv/bin" >> "$GITHUB_PATH"
      - name: Build sdist
        run: maturin sdist
      - uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a
        with:
          name: sdist
          path: target/wheels/*.tar.gz

  release:
    needs: [build, sdist]
    runs-on: ubuntu-latest
    # Spelled out because a job-level block replaces the workflow-level one:
    # contents: write is what `gh release create` below needs.
    permissions:
      contents: write
      id-token: write   # crates.io Trusted Publishing
    steps:
      - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1
      - uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c
        with:
          path: /tmp/artifacts
      - uses: dtolnay/rust-toolchain@4360b52568e2003a75bf9bc1d59f33a8e3fc893c
        with:
          toolchain: 1.96.0
          components: rustfmt, clippy
      # Exchange this job's GitHub OIDC identity for a short-lived crates.io
      # token. v0.3.15 failed here with "403 Forbidden: authentication failed"
      # because the former long-lived secret had gone stale, and it only
      # surfaced after the tag was pushed and every artifact was built. The
      # action's post step revokes the token when the job ends.
      #
      # Pinned to an exact tag deliberately: rust-lang/crates-io-auth-action
      # publishes only v1.0.x tags and has no floating `v1`, so the `@v1` its
      # README shows does not resolve and fails the release at this step.
      - name: Authenticate to crates.io via Trusted Publishing
        id: crates_auth
        if: ${{ !inputs.dry_run && !inputs.skip_crates_io }}
        # v1.0.5
        uses: rust-lang/crates-io-auth-action@c6f97d42243bad5fab37ca0427f495c86d5b1a18

      - name: Publish to crates.io
        if: ${{ !inputs.dry_run && !inputs.skip_crates_io }}
        env:
          CARGO_REGISTRY_TOKEN: ${{ steps.crates_auth.outputs.token }}
        run: |
          if ! output=$(cargo publish --locked 2>&1); then
            # crates.io rejects a re-upload with "crate version `X` is already
            # uploaded", so a re-run after a failure in a later step does not
            # die on a crate this workflow already published.
            if echo "$output" | grep -q "already uploaded"; then
              echo "Crate already published to crates.io, skipping"
            else
              echo "$output"
              exit 1
            fi
          fi

      - name: Test crates.io publish (dry run)
        if: ${{ inputs.dry_run == true && inputs.skip_crates_io != true }}
        run: |
          echo "DRY RUN: Would publish to crates.io"
          cargo publish --dry-run --locked

      - name: Skip crates.io publishing
        if: ${{ inputs.skip_crates_io == true }}
        run: echo "Skipping crates.io publishing as requested"

      - name: Install uv
        uses: astral-sh/setup-uv@20cfd1bf945f4377ade1205e4dbc17946fc9a30d

      - name: Publish to PyPI
        # actions/upload-artifact preserves the `dist/` prefix from the build
        # job, so wheels live at release-*/dist/*.whl, not release-*/*.whl.
        if: ${{ !inputs.dry_run && !inputs.skip_pypi }}
        run: uv publish /tmp/artifacts/release-*/dist/*.whl /tmp/artifacts/sdist/*.tar.gz
        env:
          UV_PUBLISH_TOKEN: ${{ secrets.PYPI_API_TOKEN }}

      - name: Validate PyPI artifacts
        if: ${{ inputs.dry_run == true && inputs.skip_pypi != true }}
        run: uvx --from twine==6.2.0 twine check --strict /tmp/artifacts/release-*/dist/*.whl /tmp/artifacts/sdist/*.tar.gz

      - name: Create GitHub Release
        if: ${{ !inputs.dry_run }}
        run: |
          gh release create ${{ github.ref_name }} \
            --title "${{ github.ref_name }}" \
            --generate-notes \
            /tmp/artifacts/release-*/*.tar.gz \
            /tmp/artifacts/release-*/*.sha256
        env:
          GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}

      - name: Dry Run Summary
        if: ${{ inputs.dry_run == true }}
        run: |
          echo "Dry run complete. Artifacts built but nothing published."
          echo "Archives:"
          find /tmp/artifacts/release-* -type f | sort

  update-homebrew:
    needs: release
    if: ${{ inputs.dry_run != true }}
    runs-on: ubuntu-latest
    steps:
      - uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c
        with:
          path: /tmp/artifacts

      - name: Compute SHA256 hashes
        id: hashes
        run: |
          for target in x86_64-apple-darwin aarch64-apple-darwin x86_64-unknown-linux-gnu aarch64-unknown-linux-gnu; do
            sha=$(cat /tmp/artifacts/release-${target}/jira-cli-${{ github.ref_name }}-${target}.tar.gz.sha256 | awk '{print $1}')
            key=$(echo "${target}" | tr '-' '_')
            echo "${key}=${sha}" >> "$GITHUB_OUTPUT"
          done

      - name: Update Homebrew formula
        env:
          HOMEBREW_TAP_DEPLOY_KEY: ${{ secrets.HOMEBREW_TAP_DEPLOY_KEY }}
        run: |
          VERSION="${{ github.ref_name }}"
          VERSION_NUM="${VERSION#v}"

          cat > /tmp/jira-cli.rb << 'FORMULA'
          class JiraCli < Formula
            desc "CLI for Jira"
            homepage "https://github.com/rvben/jira-cli"
            version "VERSION_NUM"
            license "MIT"

            on_macos do
              if Hardware::CPU.arm?
                url "https://github.com/rvben/jira-cli/releases/download/VERSION/jira-cli-VERSION-aarch64-apple-darwin.tar.gz"
                sha256 "SHA_AARCH64_APPLE_DARWIN"
              else
                url "https://github.com/rvben/jira-cli/releases/download/VERSION/jira-cli-VERSION-x86_64-apple-darwin.tar.gz"
                sha256 "SHA_X86_64_APPLE_DARWIN"
              end
            end

            on_linux do
              if Hardware::CPU.arm?
                url "https://github.com/rvben/jira-cli/releases/download/VERSION/jira-cli-VERSION-aarch64-unknown-linux-gnu.tar.gz"
                sha256 "SHA_AARCH64_UNKNOWN_LINUX_GNU"
              else
                url "https://github.com/rvben/jira-cli/releases/download/VERSION/jira-cli-VERSION-x86_64-unknown-linux-gnu.tar.gz"
                sha256 "SHA_X86_64_UNKNOWN_LINUX_GNU"
              end
            end

            def install
              bin.install "jira"
            end

            test do
              system "#{bin}/jira", "--version"
            end
          end
          FORMULA

          sed -i "s/VERSION_NUM/${VERSION_NUM}/g" /tmp/jira-cli.rb
          sed -i "s/VERSION/${VERSION}/g" /tmp/jira-cli.rb
          sed -i "s/SHA_AARCH64_APPLE_DARWIN/${{ steps.hashes.outputs.aarch64_apple_darwin }}/g" /tmp/jira-cli.rb
          sed -i "s/SHA_X86_64_APPLE_DARWIN/${{ steps.hashes.outputs.x86_64_apple_darwin }}/g" /tmp/jira-cli.rb
          sed -i "s/SHA_AARCH64_UNKNOWN_LINUX_GNU/${{ steps.hashes.outputs.aarch64_unknown_linux_gnu }}/g" /tmp/jira-cli.rb
          sed -i "s/SHA_X86_64_UNKNOWN_LINUX_GNU/${{ steps.hashes.outputs.x86_64_unknown_linux_gnu }}/g" /tmp/jira-cli.rb

          # Authenticate to the tap with a write deploy key scoped to
          # rvben/homebrew-tap. The key does not expire, so cross-repo pushes
          # keep working without periodic token rotation.
          mkdir -p ~/.ssh
          echo "$HOMEBREW_TAP_DEPLOY_KEY" > ~/.ssh/id_ed25519
          chmod 600 ~/.ssh/id_ed25519
          ssh-keyscan -t ed25519 github.com >> ~/.ssh/known_hosts 2>/dev/null

          git clone git@github.com:rvben/homebrew-tap.git /tmp/tap
          mkdir -p /tmp/tap/Formula
          cp /tmp/jira-cli.rb /tmp/tap/Formula/jira-cli.rb
          cd /tmp/tap
          git config user.name "github-actions[bot]"
          git config user.email "github-actions[bot]@users.noreply.github.com"
          git add Formula/jira-cli.rb
          git diff --cached --quiet || git commit -m "Update jira-cli to ${VERSION}"
          git push

  attest-release:
    name: Attest release artifacts
    needs: release
    if: ${{ inputs.dry_run != true }}
    runs-on: ubuntu-latest
    permissions:
      contents: read
      id-token: write
      attestations: write
    steps:
      - name: Download release artifacts
        uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c
        with:
          path: artifacts
      - name: Attest release artifacts
        uses: actions/attest@1e69f48acb82d1966a394da916b4c1698aa569d6
        with:
          subject-path: artifacts/**/*