44 lines
2.5 KiB
TOML
44 lines
2.5 KiB
TOML
[presets.gitea]
|
|
variables.publish_repo = "{{ 'PUBLISH_REPO' | env }}"
|
|
variables.publish_group = "{{ 'PUBLISH_GROUP' | env }}"
|
|
variables.publish_password = "{{ 'PUBLISH_PASSWORD' | env }}"
|
|
variables.publish_artefacts = {}
|
|
|
|
variables.publish_auth_header = "-H 'Authorization: token {{ publish_password }}'"
|
|
variables.publish_api_url = "https://{{ publish_repo }}/api"
|
|
variables.publish_packages_url = "{{ publish_api_url }}/packages/{{ publish_group }}"
|
|
variables.publish_generic_url = "{{ publish_packages_url }}/generic/{{ project_name }}/{{ project_version }}"
|
|
variables.publish_releases_url = "{{ publish_api_url }}/v1/repos/{{ publish_group }}/{{ project_name }}/releases"
|
|
variables.publish_release_tag_url = "{{ publish_releases_url }}/tags/{{ project_version }}"
|
|
|
|
[presets.gitea.tasks.publish."{{ publish_artefacts | tojson }}"]
|
|
conditions = ["{{ item | file }}"]
|
|
variables.artefact_file = "{{ item }}"
|
|
variables.artefact_name = "{{ (artefact_file | file).name }}"
|
|
commands = [
|
|
"curl -s {{ publish_auth_header }} -X DELETE '{{ publish_generic_url }}/{{ artefact_name }}'",
|
|
"curl -s {{ publish_auth_header }} --fail-with-body --upload-file '{{ artefact_file }}' '{{ publish_generic_url }}/{{ artefact_name }}'",
|
|
]
|
|
|
|
[presets.gitea.tasks.publish.debian_repo]
|
|
conditions = ["{{ publish_artefacts.debian | file }}"]
|
|
variables.artefact_file = "{{ publish_artefacts.debian }}"
|
|
commands = [
|
|
"curl -s {{ publish_auth_header }} -X DELETE '{{ publish_packages_url }}/debian/pool/noble/main/{{ project_name }}/{{ project_version }}/all'",
|
|
"curl -s {{ publish_auth_header }} --fail-with-body --upload-file '{{ artefact_file }}' '{{ publish_packages_url }}/debian/pool/noble/main/upload'",
|
|
]
|
|
|
|
[presets.gitea.tasks.release.create]
|
|
conditions = ["{{ publish_repo }}"]
|
|
commands = [
|
|
"curl -s {{ publish_auth_header }} -X DELETE '{{ publish_release_tag_url }}'",
|
|
"curl -s {{ publish_auth_header }} --fail-with-body -X POST '{{ publish_releases_url }}' -H 'Content-Type: application/json' --data '{ \"name\": \"{{ project_version }}\", \"tag_name\": \"{{ project_version }}\" }'",
|
|
]
|
|
|
|
[presets.gitea.tasks.release."{{ publish_artefacts | tojson }}"]
|
|
conditions = ["{{ item | file }}"]
|
|
variables.artefact_file = "{{ item }}"
|
|
commands = [
|
|
"(export RELEASE_ID=$(curl -s {{ publish_auth_header }} --fail {{ publish_release_tag_url }} | jq '.id') && curl -s {{ publish_auth_header }} --fail-with-body -X POST \"{{ publish_releases_url }}/$RELEASE_ID/assets\" -H 'Content-Type: multipart/form-data' -F 'attachment=@{{ artefact_file }}')",
|
|
]
|