Skip to content
This repository has been archived by the owner on Jan 6, 2023. It is now read-only.

Creating a release

Rijk van Zanten edited this page Sep 24, 2019 · 3 revisions

Step 1: Updating master

  1. Clone the api repo (use the develop branch
$ git clone [email protected]:directus/api.git --branch develop
$ cd api
  1. Create a release branch (release-v2.x.x)
$ git checkout -b release-v2.x.x
  1. 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

  1. Push the release branch to GitHub

  2. Open a PR from the release branch to master

  3. Merge (squash) release into master

  4. Merge master into develop to make sure develop is up to date with the version number change

$ git checkout develop
$ git merge master
$ git push origin develop

Step 2: Creating a bundled build

Automated

One time setup

  1. 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!"
  1. Add execute permissions to this file
$ chmod +x ./api.sh

Create the build and update the build branch

$ bash ./api.sh

Manually

  1. 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
  1. Install the composer dependencies
$ composer install -a --no-dev
  1. Clone the build branch of the api
$ cd ..
$ git clone -b build [email protected]:directus/api.git api-build
  1. Delete everything in api-build except the .git folder and composer.json file

  2. 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 ..
  1. Move these files into api-build:
  • bin/
  • config/
  • logs/
  • migrations/
  • public/
  • src/
  • vendor/
  • LICENSE.md
  • README.md
  • composer.json
  1. Delete all .DS_Store files
$ cd api-build
$ find . -name '.DS_Store' -type f -delete
  1. 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
  1. Add-commit-push
$ git add .
$ git commit -m "<VERSION NUMBER>"
$ git push origin build

Step 3: Creating the release on GitHub

  1. Download a .zip copy of the build branch from GitHub
  2. On the releases page, draft a new release
  3. Make sure to use master as Target
  4. Attach the downloaded .zip from step 1 as a binary to the release
  5. Publish the release!