|
1 | 1 | --- |
2 | | -# Linear.app CLI installation (user-specific via npm) |
| 2 | +# Linear CLI installation (schpet/linear-cli) |
| 3 | +# https://github.com/schpet/linear-cli |
3 | 4 |
|
4 | | -- name: Install Linear CLI globally for user (Linux) |
5 | | - community.general.npm: |
6 | | - name: '@digitalstories/linear-cli' |
7 | | - global: true |
8 | | - state: present |
9 | | - environment: |
10 | | - NPM_CONFIG_PREFIX: "{{ dfe_user_home }}/.npm-global" |
11 | | - become: false |
12 | | - become_user: "{{ dfe_actual_user }}" |
13 | | - when: ansible_distribution in ['Fedora', 'Ubuntu'] |
| 5 | +# ============================================================================ |
| 6 | +# MACOS - Install via Homebrew tap |
| 7 | +# ============================================================================ |
14 | 8 |
|
15 | | -- name: Install Linear CLI globally for user (macOS) |
16 | | - community.general.npm: |
17 | | - name: '@digitalstories/linear-cli' |
18 | | - global: true |
| 9 | +- name: Install Linear CLI (macOS) |
| 10 | + community.general.homebrew: |
| 11 | + name: schpet/tap/linear |
19 | 12 | state: present |
20 | | - environment: "{{ npm_config_env }}" |
21 | 13 | become: false |
22 | 14 | when: ansible_distribution == 'MacOSX' |
| 15 | + |
| 16 | +# ============================================================================ |
| 17 | +# LINUX - Install via binary from GitHub releases |
| 18 | +# ============================================================================ |
| 19 | + |
| 20 | +- name: Install Linear CLI (Linux) |
| 21 | + block: |
| 22 | + - name: Get latest Linear CLI version from GitHub API |
| 23 | + ansible.builtin.uri: |
| 24 | + url: https://api.github.com/repos/schpet/linear-cli/releases/latest |
| 25 | + return_content: true |
| 26 | + register: linear_release |
| 27 | + |
| 28 | + - name: Set Linear CLI version and architecture facts |
| 29 | + ansible.builtin.set_fact: |
| 30 | + linear_version: "{{ linear_release.json.tag_name }}" |
| 31 | + linear_arch: "{{ 'aarch64' if ansible_architecture == 'aarch64' else 'x86_64' }}" |
| 32 | + |
| 33 | + - name: Download Linear CLI binary tarball |
| 34 | + ansible.builtin.get_url: |
| 35 | + url: "https://github.com/schpet/linear-cli/releases/download/{{ linear_version }}/linear-{{ linear_arch }}-unknown-linux-gnu.tar.xz" |
| 36 | + dest: "/tmp/linear.tar.xz" |
| 37 | + mode: '0644' |
| 38 | + |
| 39 | + - name: Extract Linear CLI binary |
| 40 | + ansible.builtin.unarchive: |
| 41 | + src: /tmp/linear.tar.xz |
| 42 | + dest: /tmp |
| 43 | + remote_src: true |
| 44 | + |
| 45 | + - name: Install Linear CLI binary |
| 46 | + ansible.builtin.copy: |
| 47 | + src: "/tmp/linear-{{ linear_arch }}-unknown-linux-gnu/linear" |
| 48 | + dest: /usr/local/bin/linear |
| 49 | + mode: '0755' |
| 50 | + remote_src: true |
| 51 | + |
| 52 | + - name: Remove Linear CLI installation files |
| 53 | + ansible.builtin.file: |
| 54 | + path: "{{ item }}" |
| 55 | + state: absent |
| 56 | + loop: |
| 57 | + - /tmp/linear.tar.xz |
| 58 | + - "/tmp/linear-{{ linear_arch }}-unknown-linux-gnu" |
| 59 | + |
| 60 | + when: ansible_distribution in ['Fedora', 'Ubuntu'] |
0 commit comments