Set version in farm.info.yml via build-farmOS.sh.

This ensures that the version is correctly set in the
Docker images. Previously, it was only being set in
the packaged tarball releases.
This commit is contained in:
Michael Stenta 2021-11-30 16:56:57 -05:00
parent 8939f3058d
commit deb59bed54
3 changed files with 10 additions and 6 deletions

View File

@ -19,8 +19,7 @@ jobs:
- name: Build farmOS Docker image
run: docker build --build-arg FARMOS_REPO=https://github.com/${GITHUB_REPOSITORY} --build-arg FARMOS_VERSION=${FARMOS_VERSION} -t farmos docker
- name: Run farmOS Docker container
run: >-
docker run --rm -v /tmp/farmOS:/opt/drupal farmos sed -i "s|version: 2.x|version: ${FARMOS_VERSION}|g" /opt/drupal/web/profiles/farm/farm.info.yml
run: docker run --rm -v /tmp/farmOS:/opt/drupal farmos true
- name: Create artifact
run: cd /tmp && tar -czf farmOS-${FARMOS_VERSION}.tar.gz farmOS
- name: Create GitHub release

View File

@ -32,11 +32,11 @@ composer config repositories.farmos git ${FARMOS_REPO}
# Otherwise FARMOS_VERSION is a valid semantic versioning string. We assume
# that it is a tagged version and require that version.
if [ "${FARMOS_VERSION}" = "2.x" ]; then
FARMOS_VERSION="2.x-dev"
FARMOS_COMPOSER_VERSION="2.x-dev"
elif [[ ! "${FARMOS_VERSION}" =~ ^(0|[1-9][0-9]*)\.(0|[1-9][0-9]*)\.(0|[1-9][0-9]*)(-((0|[1-9][0-9]*|[0-9]*[a-zA-Z-][0-9a-zA-Z-]*)(\.(0|[1-9][0-9]*|[0-9]*[a-zA-Z-][0-9a-zA-Z-]*))*))?(\+([0-9a-zA-Z-]+(\.[0-9a-zA-Z-]+)*))?$ ]]; then
FARMOS_VERSION="dev-${FARMOS_VERSION}"
FARMOS_COMPOSER_VERSION="dev-${FARMOS_VERSION}"
fi
composer require farmos/farmos ${FARMOS_VERSION} --no-install
composer require farmos/farmos ${FARMOS_COMPOSER_VERSION} --no-install
# Run composer install with optional arguments passed into this script.
if [ $# -eq 0 ]; then
@ -45,5 +45,8 @@ else
composer install "$*"
fi
# Set the version in farm.info.yml.
sed -i "s|version: 2.x|version: ${FARMOS_VERSION}|g" /var/farmOS/web/profiles/farm/farm.info.yml
# Remove the Composer cache directory.
rm -rf "$COMPOSER_HOME"

View File

@ -1,9 +1,11 @@
name: farmOS
type: profile
description: 'A web-based farm record keeping application.'
version: 2.x
core_version_requirement: ^9
# This is automatically set during release packaging.
version: 2.x
# Declare this profile a distribution and mark it as 'exclusive' so that it is
# automatically selected during installation.
distribution: