Simplify running the publishing step.
continuous-integration/drone/push Build is passing
Details
continuous-integration/drone/push Build is passing
Details
This commit is contained in:
parent
e87ee2fa0b
commit
0482a50317
11
.drone.yml
11
.drone.yml
|
@ -47,15 +47,7 @@ steps:
|
||||||
- name: create-debian-package
|
- name: create-debian-package
|
||||||
image: code.birch-tree.net/dorian/mirror-server:build
|
image: code.birch-tree.net/dorian/mirror-server:build
|
||||||
commands:
|
commands:
|
||||||
- export PKG_PATH=$(cargo deb)
|
- ./publish-deb.sh
|
||||||
- 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}"
|
|
||||||
environment:
|
environment:
|
||||||
USERNAME: dorian
|
USERNAME: dorian
|
||||||
PASSWORD:
|
PASSWORD:
|
||||||
|
@ -63,6 +55,5 @@ steps:
|
||||||
depends_on:
|
depends_on:
|
||||||
- test
|
- test
|
||||||
|
|
||||||
|
|
||||||
image_pull_secrets:
|
image_pull_secrets:
|
||||||
- docker-config
|
- docker-config
|
||||||
|
|
|
@ -1,22 +1,26 @@
|
||||||
#!/usr/bin/env bash
|
#!/usr/bin/bash
|
||||||
|
|
||||||
read -r -p "Username: " USERNAME
|
if [[ -z "${USERNAME}" ]]; then
|
||||||
read -r -s -p "Password: " PASSWORD
|
echo "Set the USERNAME for Gitea"
|
||||||
|
exit 1
|
||||||
_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
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
curl --user "${USERNAME}:${PASSWORD}" \
|
if [[ -z "${PASSWORD}" ]]; then
|
||||||
--upload-file "${_deb_path}/${_deb_file}" \
|
echo "Set the PASSWORD for Gitea"
|
||||||
-X PUT \
|
exit 1
|
||||||
"https://${_gitea_server}/api/packages/${USERNAME}/generic/${_pkg_name}/${_pkg_version}/${_deb_file}"
|
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}"
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue