This commit is contained in:
@@ -1,24 +1,43 @@
|
||||
[presets.gitea]
|
||||
variables.publish_repo = "{{ 'PUBLISH_REPO' | env }}"
|
||||
variables.publish_repo_path = "{{ publish_repo }}/generic/{{ project_name }}/{{ project_version }}"
|
||||
variables.publish_user = "{{ 'PUBLISH_USER' | env }}"
|
||||
variables.publish_group = "{{ 'PUBLISH_GROUP' | env }}"
|
||||
variables.publish_password = "{{ 'PUBLISH_PASSWORD' | env }}"
|
||||
variables.publish_auth = "{{ publish_user }}:{{ publish_password }}"
|
||||
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 --user \"{{ publish_auth }}\" -X DELETE \"{{ publish_repo_path }}/{{ artefact_name }}\"",
|
||||
"curl --user \"{{ publish_auth }}\" --fail --upload-file \"{{ artefact_file }}\" \"{{ publish_repo_path }}/{{ artefact_name }}\"",
|
||||
"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 --user \"{{ publish_auth }}\" -X DELETE \"{{ publish_repo }}/debian/pool/noble/main/{{ project_name }}/{{ project_version }}/all\"",
|
||||
"curl --user \"{{ publish_auth }}\" --fail --upload-file \"{{ artefact_file }}\" \"{{ publish_repo }}/debian/pool/noble/main/upload\"",
|
||||
"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 }}')",
|
||||
]
|
||||
|
||||
@@ -36,4 +36,4 @@ commands = ["rm -rf node_modules"]
|
||||
# version
|
||||
[presets.nodejs.tasks.version.npm]
|
||||
conditions = ["{{ version }}"]
|
||||
commands = ["{{ nvm }}npm version {{ version }} --allow-same-version"]
|
||||
commands = ["{{ nvm }}npm version {{ version }} --allow-same-version --commit-hooks false --git-tag-version false"]
|
||||
|
||||
Reference in New Issue
Block a user