42 lines
1.8 KiB
YAML
42 lines
1.8 KiB
YAML
- 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 }}_{{ release_latest_tag }}"
|
|
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 }}/{{ release_filename }}_{{ release_latest_tag }}"
|
|
mode: "0644"
|
|
checksum: sha256:https://github.com/{{ gh_user }}/{{ gh_project }}/releases/download/{{ release_latest['tag'] }}/{{ release_checksum }}
|
|
when: not release_local.stat.exists
|
|
register: starship_dl
|
|
|
|
- name: "starship updated"
|
|
ansible.builtin.unarchive:
|
|
src: "{{ gh_bin_dir }}/{{ release_filename }}_{{ release_latest_tag }}"
|
|
dest: "{{ home_dir }}/bin"
|
|
when: starship_dl.changed
|