Simplify running the publishing step.
continuous-integration/drone/push Build is passing Details

This commit is contained in:
Dorian 2024-02-23 14:20:42 -05:00
parent e87ee2fa0b
commit 0482a50317
2 changed files with 23 additions and 28 deletions

View File

@ -47,15 +47,7 @@ steps:
- name: create-debian-package
image: code.birch-tree.net/dorian/mirror-server:build
commands:
- export PKG_PATH=$(cargo deb)
- export PKG_FILENAME=$(basename $PKG_PATH)
- echo $$PKG_FILENAME
- export PKG_NAME=$(basename $PKG_PATH | awk -F _ '{print $1}')
- export PKG_VERSION=$(basename $PKG_PATH | awk -F _ '{print $2}')
- echo $$PKG_NAME v$$PKG_VERSION
- curl --user "$${USERNAME}:$${PASSWORD}" \
-X PUT --upload-file "$${PKG_PATH}" \
"https://code.birch-tree.net/api/packages/$${USERNAME}/generic/$${PKG_NAME}/$${PKG_VERSION}/$${PKG_FILENAME}"
- ./publish-deb.sh
environment:
USERNAME: dorian
PASSWORD:
@ -63,6 +55,5 @@ steps:
depends_on:
- test
image_pull_secrets:
- docker-config

View File

@ -1,22 +1,26 @@
#!/usr/bin/env bash
#!/usr/bin/bash
read -r -p "Username: " USERNAME
read -r -s -p "Password: " PASSWORD
_pkg_name=mirror-server
_pkg_version=0.2.0
_deb_file="${_pkg_name}_${_pkg_version}_amd64.deb"
_deb_path="target/debian"
_gitea_server="code.birch-tree.net"
if [[ ! -f "${_deb_path}/${_deb_file}" ]];
then
echo "Run cargo deb first!"
exit 1
if [[ -z "${USERNAME}" ]]; then
echo "Set the USERNAME for Gitea"
exit 1
fi
curl --user "${USERNAME}:${PASSWORD}" \
--upload-file "${_deb_path}/${_deb_file}" \
-X PUT \
"https://${_gitea_server}/api/packages/${USERNAME}/generic/${_pkg_name}/${_pkg_version}/${_deb_file}"
if [[ -z "${PASSWORD}" ]]; then
echo "Set the PASSWORD for Gitea"
exit 1
fi
echo 'Create the Debian package...'
pkg_full_path=$(cargo deb)
pkg_filename=$(basename "${pkg_full_path}")
pkg_name=$(echo "${pkg_filename}" | awk -F _ '{print $1}')
pkg_version=$(echo "${pkg_filename}" | awk -F _ '{print $2}')
gitea_server="code.birch-tree.net"
curl --user "${USERNAME}:${PASSWORD}" \
--upload-file "${pkg_full_path}" \
-X PUT \
"https://${gitea_server}/api/packages/${USERNAME}/generic/${pkg_name}/${pkg_version}/${pkg_filename}"