diff --git a/tasks/set_forgejo_version.yml b/tasks/set_forgejo_version.yml index f44218f..7b3d195 100644 --- a/tasks/set_forgejo_version.yml +++ b/tasks/set_forgejo_version.yml @@ -35,18 +35,24 @@ gitea_version_target: "{{ gitea_remote_version }}" when: not ansible_check_mode -- name: "Set gitea version target {{ gitea_version }}" +- name: "Set forgejo version target {{ gitea_version }}" ansible.builtin.set_fact: gitea_version_target: "{{ gitea_version }}" when: gitea_version != "latest" -- name: "Get specific forgejo release metadata" - ansible.builtin.uri: - url: 'https://codeberg.org/api/v1/repos/forgejo/forgejo/releases/tags/v{{ gitea_version_target }}' - return_content: true - register: gitea_forgejo_remote_tags_metadata - become: false +- name: "Download forgejo version {{ gitea_version_target }}" when: not ansible_check_mode + block: + - name: "Get specific forgejo release metadata" + ansible.builtin.uri: + url: 'https://codeberg.org/api/v1/repos/forgejo/forgejo/releases/tags/v{{ gitea_version_target }}' + return_content: true + register: gitea_forgejo_remote_tags_metadata + become: false + rescue: + - name: "Error Downloading https://codeberg.org/api/v1/repos/forgejo/forgejo/releases/tags/v{{ gitea_version_target }}" + ansible.builtin.fail: + msg: "We did not find the forgejo version you specified. Are you sure that '{{ gitea_version_target }}' is a valid forgejo version?" - name: "Generate forgejo download url" ansible.builtin.set_fact: diff --git a/vars/main.yml b/vars/main.yml index f14adbd..b9a43e6 100644 --- a/vars/main.yml +++ b/vars/main.yml @@ -62,5 +62,5 @@ transfer_custom_footer: - 'files/gitea_footer/extra_links_footer.tmpl' - 'files/extra_links_footer.tmpl' -playbook_version_number: 45 # should be int +playbook_version_number: 46 # should be int playbook_version_path: 'do1jlr.gitea.version'