Simplified generating of .env file
This change utilises ability for jq to find values of keys across different objects and by using grep we can filter out unneeded url of releases.
Simple explanation how it works:
- Get all needed prerequisite info from gitlab:
RELEASE_URL="https://code.castopod.org/api/v4/projects/2/releases"
CASTOPOD_VERSION=$(echo $(curl --silent https://code.castopod.org/api/v4/projects/2/releases | jq '.[0] | .tag_name') | tr -d '"')
LATEST_RELEASE_URL="https://code.castopod.org/api/v4/projects/2/releases/${CASTOPOD_VERSION}"
- Download information about latest release:
echo $(curl --silent ${LATEST_RELEASE_URL})
- Download information about all urls of released files
echo $(curl --silent ${LATEST_RELEASE_URL} | jq '.assets.links[].url')
- Filter out links so we only get .zip one
echo $(curl --silent ${LATEST_RELEASE_URL} | jq '.assets.links[].url' | grep -e '.zip')
- Clean up
"
from link
echo $(curl --silent ${LATEST_RELEASE_URL} | jq '.assets.links[].url' | grep -e '.zip' | tr -d '"')