dotfiles/github-bin/marksman.yml

41 lines
1.6 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 filename for aarch64
ansible.builtin.set_fact:
release_filename: "{{ gh_project }}-linux-arm64"
when: ansible_facts['architecture'] == "aarch64"
- name: Set the release download filename for x86_64
ansible.builtin.set_fact:
release_filename: "{{ gh_project }}-linux-x64"
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: marksman_dl
- name: "marksman updated"
ansible.builtin.copy:
src: "{{ gh_bin_dir }}/{{ release_filename }}-{{ release_latest_tag }}"
dest: "{{ home_dir }}/bin/marksman"
mode: "0755"
when: marksman_dl.changed