mirror of
https://github.com/fscotto/infra.git
synced 2026-05-30 15:39:58 +00:00
Automate latest OpenCode installation
This commit is contained in:
2
TODOs.md
2
TODOs.md
@@ -3,7 +3,7 @@
|
||||
- [X] fargli creare Maildir dir
|
||||
- [X] Deve inizializzare la cartella Maildir con le sottocartelle iCloudAccount, ProtonMailAccount
|
||||
- [X] Avvio Polkit non avvia la dialog grafica per l'elevazione dei privilegi
|
||||
- [ ] Integrare tema Yaru su Flatpak
|
||||
- [X] Integrare tema Yaru su Flatpak
|
||||
- [ ] installare opencode
|
||||
- [ ] installare podman
|
||||
- [ ] Scaricare la posta
|
||||
|
||||
@@ -290,6 +290,12 @@
|
||||
desktop_tools_tmp_dir: /tmp/desktop-tools
|
||||
gitmux_version: v0.11.5
|
||||
bw_version: 1.22.1
|
||||
opencode_asset_name: >-
|
||||
{{
|
||||
'opencode-linux-x64-baseline.tar.gz' if ansible_facts['architecture'] == 'x86_64'
|
||||
else 'opencode-linux-arm64.tar.gz' if ansible_facts['architecture'] in ['aarch64', 'arm64']
|
||||
else ''
|
||||
}}
|
||||
gitmux_arch: >-
|
||||
{{
|
||||
'amd64' if ansible_facts['architecture'] == 'x86_64'
|
||||
@@ -297,6 +303,11 @@
|
||||
else ''
|
||||
}}
|
||||
|
||||
- name: Ensure architecture is supported for OpenCode binary
|
||||
ansible.builtin.fail:
|
||||
msg: "Unsupported architecture {{ ansible_facts['architecture'] }} for OpenCode release binary"
|
||||
when: opencode_asset_name == ''
|
||||
|
||||
- name: Ensure architecture is supported for gitmux binary
|
||||
ansible.builtin.fail:
|
||||
msg: "Unsupported architecture {{ ansible_facts['architecture'] }} for gitmux release binary"
|
||||
@@ -313,6 +324,53 @@
|
||||
state: directory
|
||||
mode: "0755"
|
||||
|
||||
- name: Fetch latest OpenCode release metadata
|
||||
ansible.builtin.uri:
|
||||
url: https://api.github.com/repos/anomalyco/opencode/releases/latest
|
||||
headers:
|
||||
Accept: application/vnd.github+json
|
||||
return_content: true
|
||||
register: opencode_latest_release
|
||||
changed_when: false
|
||||
|
||||
- name: Set OpenCode release asset metadata
|
||||
ansible.builtin.set_fact:
|
||||
opencode_version: "{{ opencode_latest_release.json.tag_name }}"
|
||||
opencode_asset: >-
|
||||
{{
|
||||
opencode_latest_release.json.assets
|
||||
| selectattr('name', 'equalto', opencode_asset_name)
|
||||
| first
|
||||
| default({})
|
||||
}}
|
||||
|
||||
- name: Ensure latest OpenCode asset metadata is available
|
||||
ansible.builtin.fail:
|
||||
msg: "Could not find OpenCode asset {{ opencode_asset_name }} in release {{ opencode_version }}"
|
||||
when: opencode_asset == {}
|
||||
|
||||
- name: Download OpenCode release archive
|
||||
ansible.builtin.get_url:
|
||||
url: "{{ opencode_asset.browser_download_url }}"
|
||||
dest: "{{ desktop_tools_tmp_dir }}/{{ opencode_asset.name }}"
|
||||
checksum: "{{ opencode_asset.digest | default(omit) }}"
|
||||
mode: "0644"
|
||||
|
||||
- name: Extract OpenCode release archive
|
||||
ansible.builtin.unarchive:
|
||||
src: "{{ desktop_tools_tmp_dir }}/{{ opencode_asset.name }}"
|
||||
dest: "{{ desktop_tools_tmp_dir }}"
|
||||
remote_src: true
|
||||
|
||||
- name: Install OpenCode binary
|
||||
ansible.builtin.copy:
|
||||
src: "{{ desktop_tools_tmp_dir }}/opencode"
|
||||
dest: /usr/local/bin/opencode
|
||||
remote_src: true
|
||||
owner: root
|
||||
group: root
|
||||
mode: "0755"
|
||||
|
||||
- name: Set gitmux asset metadata
|
||||
ansible.builtin.set_fact:
|
||||
gitmux_asset: "gitmux_{{ gitmux_version }}_linux_{{ gitmux_arch }}.tar.gz"
|
||||
|
||||
Reference in New Issue
Block a user