This repository has been archived by the owner on Jan 6, 2023. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 204
Creating a release
Rijk van Zanten edited this page Sep 24, 2019
·
3 revisions
- Clone the api repo (use the
develop
branch
$ git clone [email protected]:directus/api.git --branch develop
$ cd api
- Create a release branch (
release-v2.x.x
)
$ git checkout -b release-v2.x.x
- Bump the version in
src/core/Directus/Application/Application.php
and commit the change
On line 16 of the above file, change the value for the constant DIRECTUS_VERSION
-
Push the release branch to GitHub
-
Open a PR from the release branch to master
-
Merge (squash) release into
master
-
Merge
master
intodevelop
to make suredevelop
is up to date with the version number change
$ git checkout develop
$ git merge master
$ git push origin develop
- Create a
api.sh
file with the following contents:
#!/bin/bash
# Allow using globs for the file move later on
shopt -s dotglob nullglob
# Do everything in a tmp directory
mkdir ./tmp
cd tmp
# Make a fresh copy of the api
git clone [email protected]:directus/api.git -b master
cd api
# Make a fresh copy of the build branch
cd ..
git clone -b build [email protected]:directus/api.git api-build
# Delete everything in the build branch except for the git folder (so we maintain the history)
cd api-build
find . -maxdepth 1 \! \( -name .git \) -exec rm -rf '{}' \;
# Install the Composer dependencies
cd ../api
composer install -a --no-dev
# Remove all nested git folders
cd vendor
( find . -type d -name ".git" && find . -name ".gitignore" && find . -name ".gitmodules" ) | xargs rm -rf
# Move all the files to the build branch
cd ..
cp -R ./bin/. ../api-build/bin/
cp -R ./config/. ../api-build/config/
cp -R ./logs/. ../api-build/logs/
cp -R ./migrations/. ../api-build/migrations/
cp -R ./public/. ../api-build/public/
cp -R ./src/. ../api-build/src/
cp -R ./vendor/. ../api-build/vendor/
cp ./LICENSE.md ../api-build/LICENSE.md
cp ./README.md ../api-build/README.md
cp ./composer.json ../api-build/composer.json
cp ../../api-gitignore.txt ../api-build/.gitignore
cd ../api-build
# Get the version number from the user
echo "What version?"
read version
# Commit the changes
git add -A
git commit -m "$version"
git push origin build
cd ..
cd ..
rm -rf tmp
echo ""
echo "✨ All done!"
- Add execute permissions to this file
$ chmod +x ./api.sh
$ bash ./api.sh
- Clone the repo's master branch (or check it out if you already have a local copy of the API)
$ git clone [email protected]:directus/api.git --branch master
- Install the composer dependencies
$ composer install -a --no-dev
- Clone the build branch of the api
$ cd ..
$ git clone -b build [email protected]:directus/api.git api-build
-
Delete everything in
api-build
except the.git
folder andcomposer.json
file -
Delete all nested .git folders (prevent submodules)
$ cd api/vendor
$ ( find . -type d -name ".git" \
&& find . -name ".gitignore" \
&& find . -name ".gitmodules" ) | xargs rm -rf
$ cd ..
- Move these files into
api-build
:
- bin/
- config/
- logs/
- migrations/
- public/
- src/
- vendor/
- LICENSE.md
- README.md
- composer.json
- Delete all .DS_Store files
$ cd api-build
$ find . -name '.DS_Store' -type f -delete
- Add this .gitignore file:
Icon
.DS_Store
*.log
.cache
# Ignore dev files
/.idea
node_modules
package-lock.json
# Don't track composer phar/vendors
composer.phar
composer.lock
# Ignore configuration files
/config/*
!/config/migrations.php
!/config/migrations.upgrades.php
!/config/api_sample.php
# PHPUnit
/phpunit.xml
/documents
# Custom extensions
/public/extensions/custom/*/*
## Auth
/public/extensions/custom/auth
## Endpoints
!/public/extensions/custom/endpoints/_directory/
!/public/extensions/custom/endpoints/_example.php
## Hashers
!/public/extensions/custom/hashers/_CustomHasher.php
## Hooks
!/public/extensions/custom/hooks/_products
!/public/extensions/custom/hooks/_webhook
# Storage
/public/uploads/*/
!public/uploads/_/originals/.gitignore
!public/uploads/_/thumbnails/.gitignore
# Keep gitkeep files
# This will make sure empty directories has at least one file so it can be tracked by git
!**/.gitkeep
- Add-commit-push
$ git add .
$ git commit -m "<VERSION NUMBER>"
$ git push origin build
- Download a
.zip
copy of the build branch from GitHub - On the releases page, draft a new release
- Make sure to use
master
as Target - Attach the downloaded
.zip
from step 1 as a binary to the release - Publish the release!
Directus Internal Docs
Please see https://docs.directus.io for the usage guide.