Skip to content

Instantly share code, notes, and snippets.

@barathrm
Created June 6, 2021 19:01
Show Gist options
  • Save barathrm/acf9e1436fec3a7fe64f2cd422a1baa8 to your computer and use it in GitHub Desktop.
Save barathrm/acf9e1436fec3a7fe64f2cd422a1baa8 to your computer and use it in GitHub Desktop.
publish a new version on OBS
#!/usr/bin/env bash
USER="$1"
PASS="$2"
REVISION="$3"
export API="https://api.opensuse.org"
export PROJ="home:fawz:mooltipass"
export PKG="moolticute"
# for moolticute-testing
# export PKG="moolticute-testing"
export OBS_COMMIT_MSG="Update package to revision ${REVISION}"
# Fetch current _service file to CWD
curl -u $USER:$PASS -X GET ${API}/source/${PROJ}/${PKG}/_service -o _service
# Update revision to build
sed -i "s|<param name=\"revision\">\(.*\)</param>|<param name=\"revision\">${REVISION}</param>|" _service
# Push modified _service file back to OBS
curl -u $USER:$PASS -X PUT -T _service ${API}/source/${PROJ}/${PKG}/_service
# Commit changes, which will trigger a new build and eventually release
curl -u $USER:$PASS -X POST ${API}/source/${PROJ}/${PKG}?cmd=commit --data-urlencode "comment=${OBS_COMMIT_MSG}"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment