2024-10-15 03:10:59 +00:00
|
|
|
- name: "Discover the latest {{ gh_project }} release from GitHub"
|
|
|
|
community.general.github_release:
|
|
|
|
user: "{{ gh_user }}"
|
|
|
|
repo: "{{ gh_project }}"
|
|
|
|
action: latest_release
|
|
|
|
register: release_latest
|
|
|
|
|
|
|
|
- name: Set the release version strings
|
|
|
|
ansible.builtin.set_fact:
|
|
|
|
release_latest_tag: "{{ release_latest['tag'] }}"
|
|
|
|
|
|
|
|
- name: Set the release download filenames for aarch64
|
|
|
|
ansible.builtin.set_fact:
|
|
|
|
release_filename: "{{ gh_project }}-aarch64-unknown-linux-musl.tar.gz"
|
|
|
|
release_checksum: "{{ gh_project }}-aarch64-unknown-linux-musl.tar.gz.sha256"
|
|
|
|
when: ansible_facts['architecture'] == "aarch64"
|
|
|
|
|
|
|
|
- name: Set the release download filenames for x86_64
|
|
|
|
ansible.builtin.set_fact:
|
|
|
|
release_filename: "{{ gh_project }}-x86_64-unknown-linux-musl.tar.gz"
|
|
|
|
release_checksum: "{{ gh_project }}-x86_64-unknown-linux-musl.tar.gz.sha256"
|
|
|
|
when: ansible_facts['architecture'] == "x86_64"
|
|
|
|
|
|
|
|
- name: Check if the release was previously downloaded
|
|
|
|
ansible.builtin.stat:
|
|
|
|
path: "{{ gh_bin_dir }}/{{ release_filename }}"
|
|
|
|
register: release_local
|
|
|
|
|
|
|
|
- name: "Download the latest {{ gh_project }} release from GitHub"
|
|
|
|
ansible.builtin.get_url:
|
|
|
|
url: "https://github.com/{{ gh_user }}/{{ gh_project }}/releases/download/{{ release_latest_tag }}/{{ release_filename }}"
|
|
|
|
dest: "{{ gh_bin_dir }}"
|
|
|
|
mode: "0644"
|
|
|
|
checksum: sha256:https://github.com/{{ gh_user }}/{{ gh_project }}/releases/download/{{ release_latest['tag'] }}/{{ release_checksum }}
|
|
|
|
when: not release_local.stat.exists
|
2024-10-15 19:14:08 +00:00
|
|
|
register: starship_dl
|
|
|
|
|
|
|
|
- name: "starship updated"
|
|
|
|
ansible.builtin.unarchive:
|
|
|
|
src: "{{ gh_bin_dir }}/{{ release_filename }}"
|
|
|
|
dest: "{{ home_dir }}/bin"
|
|
|
|
when: starship_dl.changed
|