You've already forked gitea-composer-upload-action
Compare commits
10 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 8402f345cf | |||
| 1f18b83405 | |||
| a2d9b28aa5 | |||
| d2dc5da7d4 | |||
| 14058cc306 | |||
| 8170a5179d | |||
| 2cb2d440c5 | |||
| e80fed6fe7 | |||
| dd653b4a2f | |||
| 6dbfd3e120 |
@@ -1,6 +1,9 @@
|
|||||||
FROM cybercinch/base-alpine-bash:latest
|
FROM cybercinch/base-alpine-bash:latest
|
||||||
|
|
||||||
COPY scripts/docker-entrypoint.sh /entrypoint.sh
|
COPY scripts/docker-entrypoint.sh /entrypoint.sh
|
||||||
|
RUN chmod a+x /entrypoint.sh
|
||||||
|
|
||||||
|
ENV upload_file="build/Package.zip"
|
||||||
|
ENV overwrite_files="false"
|
||||||
|
|
||||||
ENV upload_file=build/Package.zip
|
|
||||||
CMD ["/entrypoint.sh"]
|
CMD ["/entrypoint.sh"]
|
||||||
18
action.yml
18
action.yml
@@ -1,7 +1,7 @@
|
|||||||
name: "Gitea Composer upload package"
|
name: "Gitea Composer upload package"
|
||||||
description: "Updating a composer package in the Gitea system using GitHub Actions"
|
description: "Updating a composer package in the Gitea system using GitHub Actions"
|
||||||
inputs:
|
inputs:
|
||||||
base_url:
|
baseurl:
|
||||||
description: "Base URL for Gitea Instance"
|
description: "Base URL for Gitea Instance"
|
||||||
required: true
|
required: true
|
||||||
username:
|
username:
|
||||||
@@ -23,17 +23,17 @@ inputs:
|
|||||||
upload_file:
|
upload_file:
|
||||||
description: "The file path to upload"
|
description: "The file path to upload"
|
||||||
required: false
|
required: false
|
||||||
default: "build/Pacakge.zip"
|
default: "build/Package.zip"
|
||||||
runs:
|
runs:
|
||||||
using: "docker"
|
using: "docker"
|
||||||
image: "Dockerfile"
|
image: "Dockerfile"
|
||||||
args:
|
env:
|
||||||
- ${{ inputs.base_url }}
|
baseurl: ${{ inputs.baseurl }}
|
||||||
- ${{ inputs.username }}
|
username: ${{ inputs.username }}
|
||||||
- ${{ inputs.access_token }}
|
access_token: ${{ inputs.access_token }}
|
||||||
- ${{ inputs.owner }}
|
version: ${{ inputs.version }}
|
||||||
- ${{ inputs.version }}
|
overwrite_files: ${{ inputs.overwrite_files }}
|
||||||
- ${{ inputs.overwrite_files }}
|
|
||||||
branding:
|
branding:
|
||||||
icon: 'package'
|
icon: 'package'
|
||||||
color: 'green'
|
color: 'green'
|
||||||
@@ -37,30 +37,31 @@ action_error() {
|
|||||||
# Verify that the minimally required password settings are set for operation.
|
# Verify that the minimally required password settings are set for operation.
|
||||||
function verify_minimum_env {
|
function verify_minimum_env {
|
||||||
if [ -z "$username" ]; then
|
if [ -z "$username" ]; then
|
||||||
action_warn "username is required for plugin operation"
|
action_warn "username is required for action operation"
|
||||||
fi
|
fi
|
||||||
if [ -z "$baseurl" ]; then
|
if [ -z "$baseurl" ]; then
|
||||||
action_warn "gitea_baseurl setting is required for plugin operation"
|
action_warn "baseurl setting is required for action operation"
|
||||||
fi
|
fi
|
||||||
if [ -z "$owner" ]; then
|
if [ -z "$owner" ]; then
|
||||||
action_warn "gitea_owner setting is required for plugin operation"
|
action_warn "owner setting is required for action operation"
|
||||||
fi
|
fi
|
||||||
if [ -z "$access_token" ]; then
|
if [ -z "$access_token" ]; then
|
||||||
action_warn "gitea_token setting is required for plugin operation"
|
action_warn "access_token setting is required for action operation"
|
||||||
fi
|
fi
|
||||||
if [ -z "$version" ]; then
|
if [ -z "$version" ]; then
|
||||||
action_warn "gitea_version setting is required for plugin operation"
|
action_warn "version setting is required for action operation"
|
||||||
fi
|
fi
|
||||||
if [ -z "$username" ] ||
|
if [ -z "$username" ] ||
|
||||||
[ -z "$baseurl" ] ||
|
[ -z "$baseurl" ] ||
|
||||||
[ -z "$version" ] ||
|
[ -z "$version" ] ||
|
||||||
[ -z "$access_token" ]; then
|
[ -z "$access_token" ]; then
|
||||||
action_error <<-'EOF'
|
action_error <<-'EOF'
|
||||||
You need to specify one/all of the following settings:
|
You need to specify one/all of the following settings:
|
||||||
- username
|
- username
|
||||||
- access_token
|
- access_token
|
||||||
- baseurl
|
- baseurl
|
||||||
EOF
|
EOF
|
||||||
|
exit 1
|
||||||
fi
|
fi
|
||||||
action_note "Sufficient configuration"
|
action_note "Sufficient configuration"
|
||||||
|
|
||||||
@@ -68,9 +69,12 @@ function verify_minimum_env {
|
|||||||
|
|
||||||
function delete_file {
|
function delete_file {
|
||||||
no_prefix_version="${version##v}"
|
no_prefix_version="${version##v}"
|
||||||
|
username_or_owner=${owner:-$username}
|
||||||
|
no_owner_repo_name="${GITHUB_REPOSITORY##"$username_or_owner"/}"
|
||||||
|
# shellcheck disable=SC2154
|
||||||
for file in ${upload_file}; do
|
for file in ${upload_file}; do
|
||||||
#action_note "curl -s -o /dev/null -w '%{http_code}' --user \"${username}:${access_token}\" -X DELETE ${baseurl}/api/packages/${owner:-$username}/composer/${owner:-$username}%2F${repo_name}/${no_prefix_version}"
|
action_note "curl -s -o /dev/null -w '%{http_code}' --user \"${username}:${access_token}\" -X DELETE ${baseurl}/api/v1/packages/${owner:-$username}/composer/${owner:-$username}%2F${no_owner_repo_name}/${no_prefix_version}"
|
||||||
response=$(curl -s -o /dev/null -w "%{http_code}" --user "${username}:${access_token}" -X DELETE "${baseurl}/api/v1/packages/${owner:-$username}/composer/${owner:-$username}%2F${repo_name}/${no_prefix_version}")
|
response=$(curl -s -o /dev/null -w "%{http_code}" --user "${username}:${access_token}" -X DELETE "${baseurl}/api/v1/packages/${owner:-$username}/composer/${owner:-$username}%2F${no_owner_repo_name}/${no_prefix_version}")
|
||||||
if [ "${response}" == 204 ] || [ "${response}" == 200 ]; then
|
if [ "${response}" == 204 ] || [ "${response}" == 200 ]; then
|
||||||
action_note "Deleted package version ${version} for ${owner:-$username}/${repo_name}"
|
action_note "Deleted package version ${version} for ${owner:-$username}/${repo_name}"
|
||||||
elif [ "${response}" == 404 ]; then
|
elif [ "${response}" == 404 ]; then
|
||||||
|
|||||||
Reference in New Issue
Block a user