self-hosting/roles/forgejo/tasks/binary.yml

34 lines
1 KiB
YAML

---
- name: Find if latest available version is installed
become: true
ansible.builtin.stat:
path: "{{ forgejo_run_dir }}/forgejo-{{ latest_forgejo.version }}"
register: latest_installed_binary
- name: Get latest forgejo binary
become: true
ansible.builtin.get_url:
url: "{{ (ansible_facts['architecture'] == 'x86_64') | ternary(latest_forgejo.amd64.binary, latest_forgejo.arm_6.binary) }}"
dest: "{{ forgejo_run_dir }}/forgejo-{{ latest_forgejo.version }}"
owner: git
group: git
mode: 0644
when: not latest_installed_binary.stat.exists
notify:
- Receive forgejo pgp key
- Download forgejo asc file
- Verify forgejo binary with gpg
- name: Verify downloaded binary
ansible.builtin.meta: flush_handlers
- name: Copy binary to global location
become: true
ansible.builtin.copy:
src: "{{ forgejo_run_dir }}/forgejo-{{ latest_forgejo.version }}"
dest: /usr/local/bin/forgejo
remote_src: true
owner: root
group: root
mode: 0755
notify: Restart forgejo service