This commit is contained in:
Michael Stenta 2023-10-27 05:58:48 -06:00 committed by GitHub
commit dff8d2a486
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 32 additions and 6 deletions

View File

@ -130,8 +130,10 @@ jobs:
- name: Test Drush site install with all modules
run: docker compose exec -u www-data -T www drush site-install --db-url=${{ matrix.DB_URL }} farm farm.modules='all'
release:
name: Create GitHub release
if: github.event_name == 'push' && github.ref_type == 'tag'
name: Create release
# We only create a release if this is a tag push event to the official
# repository.
if: github.repository == 'farmOS/farmOS' && github.event_name == 'push' && github.ref_type == 'tag'
runs-on: ubuntu-latest
needs:
- build
@ -159,6 +161,21 @@ jobs:
files: /tmp/farmOS-${{ env.FARMOS_VERSION }}.tar.gz
draft: false
prerelease: false
- name: Checkout the farmOS/composer-project repository
uses: actions/checkout@v3
with:
repository: farmOS/composer-project
ref: 2.x
path: composer-project
- name: Tag a new release of farmOS/composer-project
run: |
cd composer-project
cp /tmp/farmOS/composer.json ./
cp /tmp/farmOS/composer.lock ./
git add .
git commit -m 'farmOS ${{ env.FARMOS_VERSION }}'
git tag ${{ env.FARMOS_VERSION }}
git push origin ${{ env.FARMOS_VERSION }}
publish:
name: Publish to Docker Hub
# We only publish to Docker Hub if this is a tag or 2.x branch push event

View File

@ -23,8 +23,17 @@ git reset --hard
# Create a temporary Composer cache directory.
export COMPOSER_HOME="$(mktemp -d)"
# Add the farmOS repository to composer.json.
composer config repositories.farmos git ${FARMOS_REPO}
# If FARMOS_VERSION is a valid semantic versioning string, we assume that it is
# a tagged version.
IS_TAGGED_RELEASE=false
if [[ "${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
IS_TAGGED_RELEASE=true
fi
# Add the farmOS repository to composer.json (if this is not a tagged release).
if [[ ! ${IS_TAGGED_RELEASE} ]]; then
composer config repositories.farmos git ${FARMOS_REPO}
fi
# Require the correct farmOS version in composer.json. Defaults to 2.x.
# If FARMOS_VERSION is not a valid semantic versioning string, we assume that
@ -33,10 +42,10 @@ composer config repositories.farmos git ${FARMOS_REPO}
# that it is a tagged version and require that version.
if [ "${FARMOS_VERSION}" = "2.x" ]; then
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
elif [[ ! ${IS_TAGGED_RELEASE} ]]; then
FARMOS_COMPOSER_VERSION="dev-${FARMOS_VERSION}"
fi
composer require farmos/farmos ${FARMOS_COMPOSER_VERSION} --no-install
composer require farmos/farmos:${FARMOS_COMPOSER_VERSION} --no-install
# Add allow-plugins config.
allowedPlugins=(