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:
|
2024-10-17 19:27:11 +00:00
|
|
|
path: "{{ gh_bin_dir }}/{{ release_filename }}_{{ release_latest_tag }}"
|
2024-10-15 03:10:59 +00:00
|
|
|
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 }}"
|
2024-10-17 19:27:11 +00:00
|
|
|
dest: "{{ gh_bin_dir }}/{{ release_filename }}_{{ release_latest_tag }}"
|
2024-10-15 03:10:59 +00:00
|
|
|
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:
|
2024-10-17 19:27:11 +00:00
|
|
|
src: "{{ gh_bin_dir }}/{{ release_filename }}_{{ release_latest_tag }}"
|
2024-10-15 19:14:08 +00:00
|
|
|
dest: "{{ home_dir }}/bin"
|
|
|
|
when: starship_dl.changed
|