mirror of
https://github.com/django-cms/django-cms.git
synced 2026-01-16 13:29:00 +03:00
ci: Add GitHub action to make a release (#7454)
* Creat e test action * Update make release action * Find base branch * Fix branch detection * setup commit user * Add virtual env * Delete remote branch only if it exists * Remove read command * Create local copy of scripts * First delete old local branch then remote... * Allow repeated execution
This commit is contained in:
parent
892baa8a26
commit
c25ecc27dd
27
.github/workflows/make-release.yml
vendored
Normal file
27
.github/workflows/make-release.yml
vendored
Normal file
|
|
@ -0,0 +1,27 @@
|
|||
name: Create a django CMS release
|
||||
|
||||
on:
|
||||
workflow_dispatch:
|
||||
inputs:
|
||||
version:
|
||||
description: 'Version number to create, e.g., "3.11.1rc1"'
|
||||
required: true
|
||||
type: string
|
||||
branches:
|
||||
- 'develop*'
|
||||
- 'release/**'
|
||||
|
||||
jobs:
|
||||
make-release:
|
||||
if: github.actor == 'marksweb' || github.actor == 'fsbraun'
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Check out
|
||||
uses: actions/checkout@v3
|
||||
- name: Set up Python ${{ matrix.python-version }}
|
||||
uses: actions/setup-python@v3
|
||||
- name: Start building version ${{ inputs.version }}
|
||||
env:
|
||||
BUILD_BRANCH: release/build
|
||||
TX_TOKEN: ${{ secrets.TX_TOKEN }}
|
||||
run: ./scripts/make-release ${{ inputs.version }} ${GITHUB_REF}
|
||||
11
.tx/config
11
.tx/config
|
|
@ -1,12 +1,13 @@
|
|||
[main]
|
||||
host = https://www.transifex.com
|
||||
|
||||
[django-cms.js]
|
||||
[o:divio:p:django-cms:r:core]
|
||||
file_filter = cms/locale/<lang>/LC_MESSAGES/django.po
|
||||
source_file = cms/locale/en/LC_MESSAGES/django.po
|
||||
source_lang = en
|
||||
|
||||
[o:divio:p:django-cms:r:js]
|
||||
file_filter = cms/locale/<lang>/LC_MESSAGES/djangojs.po
|
||||
source_file = cms/locale/en/LC_MESSAGES/djangojs.po
|
||||
source_lang = en
|
||||
|
||||
[django-cms.core]
|
||||
file_filter = cms/locale/<lang>/LC_MESSAGES/django.po
|
||||
source_file = cms/locale/en/LC_MESSAGES/django.po
|
||||
source_lang = en
|
||||
|
|
|
|||
|
|
@ -1,6 +1,11 @@
|
|||
import django
|
||||
|
||||
__version__ = '3.11.0'
|
||||
|
||||
if django.VERSION < (3, 2):
|
||||
default_app_config = 'cms.apps.CMSConfig'
|
||||
try:
|
||||
import django
|
||||
|
||||
if django.VERSION < (3, 2):
|
||||
default_app_config = 'cms.apps.CMSConfig'
|
||||
|
||||
except ModuleNotFoundError:
|
||||
# dependencies not installed yet
|
||||
pass
|
||||
|
|
|
|||
|
|
@ -117,7 +117,7 @@ msgid "Language independent options"
|
|||
msgstr "Taalonafhankelijke opties"
|
||||
|
||||
msgid "You entered an invalid URL."
|
||||
msgstr ""
|
||||
msgstr "U heeft een ongeldige URL ingevoerd."
|
||||
|
||||
#, python-format
|
||||
msgid "Please set the %(language)s slug before editing its advanced settings."
|
||||
|
|
@ -405,22 +405,22 @@ msgid ""
|
|||
msgstr "Dit is een alias-referentie, je kunt de inhoud alleen aanpassen op de <a href=\"%(page_url)s?edit\" target=\"_parent\">%(page_title)s</a>-pagina."
|
||||
|
||||
msgid "Getting started developer guide"
|
||||
msgstr ""
|
||||
msgstr "Aan de slag met de ontwikkel handleiding"
|
||||
|
||||
msgid "Documentation"
|
||||
msgstr "Documentatie"
|
||||
|
||||
msgid "User guide"
|
||||
msgstr ""
|
||||
msgstr "Gebruikershandleiding"
|
||||
|
||||
msgid "Support Forum"
|
||||
msgstr ""
|
||||
msgstr "Helpforum"
|
||||
|
||||
msgid "Support Slack"
|
||||
msgstr ""
|
||||
msgstr "Help bij Slack"
|
||||
|
||||
msgid "What's new"
|
||||
msgstr ""
|
||||
msgstr "Wat is nieuw"
|
||||
|
||||
msgid "Create"
|
||||
msgstr "Maken"
|
||||
|
|
@ -463,7 +463,7 @@ msgid "Language"
|
|||
msgstr "Taal"
|
||||
|
||||
msgid "Help"
|
||||
msgstr ""
|
||||
msgstr "Help"
|
||||
|
||||
msgid "Structure"
|
||||
msgstr "Structuur"
|
||||
|
|
@ -1013,7 +1013,7 @@ msgid "last change by"
|
|||
msgstr "laatst bewerkt door"
|
||||
|
||||
msgid "last change on"
|
||||
msgstr ""
|
||||
msgstr "laatst gewijzigd op"
|
||||
|
||||
msgid "meta"
|
||||
msgstr "meta"
|
||||
|
|
@ -1586,13 +1586,13 @@ msgid "Add plugin to %(plugin_name)s"
|
|||
msgstr "Voeg plugin toe aan %(plugin_name)s"
|
||||
|
||||
msgid "Community forum"
|
||||
msgstr ""
|
||||
msgstr "Gemeenschapsforum"
|
||||
|
||||
msgid "Getting started"
|
||||
msgstr ""
|
||||
msgstr "Aan de slag"
|
||||
|
||||
msgid "Talk to us"
|
||||
msgstr ""
|
||||
msgstr "Praat met ons"
|
||||
|
||||
msgid "CMS - your user account was created."
|
||||
msgstr "CMS - je gebruikersaccount is aangemaakt."
|
||||
|
|
@ -1612,7 +1612,7 @@ msgstr "Deze placeholder bevat al het maximale aantal (%(limit)s) van toegestane
|
|||
|
||||
#, python-format
|
||||
msgid "This placeholder already has the maximum number of child plugins (%s)."
|
||||
msgstr ""
|
||||
msgstr "Deze placeholder bevat al het maximale aantal (%s) van toegestane plugins."
|
||||
|
||||
#, python-brace-format
|
||||
msgid "Unable to find the specified CMS_REQUEST_IP_RESOLVER module: \"{0}\"."
|
||||
|
|
|
|||
|
|
@ -41,6 +41,9 @@ fi
|
|||
|
||||
if [ -n "$2" ]; then
|
||||
base_branch="$2"
|
||||
if [[ $base_branch == refs/heads/* ]]; then
|
||||
base_branch=$(echo $base_branch | cut -d/ -f3-)
|
||||
fi
|
||||
if ! git branch -a | grep -q "${base_branch}\$"; then
|
||||
error "Can not find specified base branch ${base_branch}"
|
||||
exit 1
|
||||
|
|
@ -65,6 +68,10 @@ if [ ! -d .git ] || [ ! -d "cms" ]; then
|
|||
exit 1
|
||||
fi
|
||||
|
||||
# setup commit
|
||||
git config --local user.email "info@django-cms.org"
|
||||
git config --local user.name "Github Release Action"
|
||||
|
||||
# check that git is configured for commit
|
||||
if ! git config user.name >/dev/null || ! git config user.email >/dev/null; then
|
||||
error "Git must be configured for commit, please run the following commands first:"
|
||||
|
|
@ -83,10 +90,13 @@ if [ -z "${origin}" ]; then
|
|||
exit 1
|
||||
fi
|
||||
|
||||
if echo "${origin}" | grep -q "${upstream_pattern}"; then
|
||||
error "please configure the origin to your fork, not official django CMS origin ${origin}"
|
||||
exit 1
|
||||
fi
|
||||
# Create virtual environment
|
||||
python -m venv .venv
|
||||
source ./.venv/bin/activate
|
||||
|
||||
# Create copy of scripts so they are not lost when changing branches
|
||||
cp -R "$SCRIPTS" "$RUNNER_TEMP"/.scripts
|
||||
SCRIPTS="$RUNNER_TEMP/.scripts"
|
||||
|
||||
check_virtual_env
|
||||
|
||||
|
|
@ -104,6 +114,7 @@ fi
|
|||
|
||||
OLDVER=$(python -c "import cms; print(cms.__version__)" )
|
||||
|
||||
git fetch --all --tags --quiet
|
||||
if [ -z "$(git tag -l "${OLDVER}")" ]; then
|
||||
error "Can not find tag for version ${OLDVER} aborting ..."
|
||||
exit 1
|
||||
|
|
@ -115,61 +126,54 @@ if git tag | grep -q "\<${TAG}\>"; then
|
|||
exit 1
|
||||
fi
|
||||
|
||||
# check if the build_branch is supplied
|
||||
if [ -z $BUILD_BRANCH ]; then
|
||||
error "BUILD_BRANCH is not specified"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# check if the build_branch is supplied
|
||||
if [ -z $TX_TOKEN ]; then
|
||||
error "TX_TOKEN is not specified. Get transifex token and add it as the TX_TOKEN secret."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
##
|
||||
## Let's roll it
|
||||
##
|
||||
|
||||
status "****************************************************************************************"
|
||||
status "*** django CMS OFFICIAL RELEASE PROCESS ***"
|
||||
status "****************************************************************************************"
|
||||
status "******************************************************************************"
|
||||
status "*** django CMS OFFICIAL RELEASE PROCESS ***"
|
||||
status "******************************************************************************"
|
||||
echo ""
|
||||
echo -e "${RED}WARNING!${NORMAL} This script will ${RED}REVERT ALL LOCAL MODIFICATIONS!${NORMAL}"
|
||||
echo ""
|
||||
echo -e "Preparing to create a release ${GREEN}${VERSION}${VERSUFFIX}${NORMAL} from content of ${YELLOW}${base_branch}${NORMAL} (currently version ${YELLOW}${OLDVER}${NORMAL})"
|
||||
echo "using fork: ${origin}"
|
||||
echo ""
|
||||
status "(Ctrl-C to abort, ${BLUE}Enter${YELLOW} to continue)"
|
||||
read -r
|
||||
|
||||
|
||||
# checkinrg upstream really point to djangoCMS
|
||||
status "- Setting up upstream to ${upstream_source}"
|
||||
|
||||
upstream=$(git remote -v | grep fetch | grep upstream | awk '{print $2}')
|
||||
if [ "${upstream_source}" != "${upstream}" ]; then
|
||||
if [ -n "${upstream}" ]; then
|
||||
git remote remove upstream
|
||||
fi
|
||||
git remote add upstream ${upstream_source}
|
||||
fi
|
||||
|
||||
status "- Cleaning the environment:"
|
||||
# first go to ${base_branch} (default is develop) and ensure we got the latest and greatest
|
||||
git clean -dfx
|
||||
git restore --staged .
|
||||
git checkout .
|
||||
git pull upstream "${base_branch}"
|
||||
|
||||
# installing needed nodejs module
|
||||
status "- syncing fork"
|
||||
# updating the local repository, and pushing this to fork
|
||||
git pull upstream "${base_branch}"
|
||||
git push -u origin "${base_branch}"
|
||||
|
||||
status "- preparing branch ${BRANCH}"
|
||||
# checking if the branch exists?
|
||||
if ! git branch -a | grep -q "remotes/upstream/${BRANCH}\$"; then
|
||||
if ! git branch -a | grep -q "remotes/origin/${BRANCH}\$"; then
|
||||
git checkout -b "${BRANCH}"
|
||||
git push upstream "${BRANCH}"
|
||||
else
|
||||
echo "You appear to already have a ${BRANCH} created, using it"
|
||||
git checkout "${BRANCH}"
|
||||
git pull upstream "${BRANCH}"
|
||||
fi
|
||||
|
||||
# cleaning on the branch
|
||||
git clean -f
|
||||
git checkout .
|
||||
if git branch -a | grep -q "remotes/origin/${BUILD_BRANCH}\$"; then
|
||||
git push origin --delete "${BUILD_BRANCH}"
|
||||
fi
|
||||
git checkout -b "${BUILD_BRANCH}" "${BRANCH}"
|
||||
# For manipulation of branch take old version from this branch
|
||||
OLDVER=$(python -c "import cms; print(cms.__version__)" )
|
||||
|
||||
# ensuring we have the proper env installed in pip
|
||||
"${SCRIPTS}/prepare-buildenv"
|
||||
|
|
@ -177,20 +181,19 @@ cd cms
|
|||
|
||||
# 2.2: make messages and push them
|
||||
|
||||
status "- Creating transifex messages!"
|
||||
|
||||
status "- Sending messages to transifex does not work currently"
|
||||
status " Send them manually before creating a version"
|
||||
# status "- Creating transifex messages!"
|
||||
"$SCRIPTS/tx" --token "$TX_TOKEN" status
|
||||
"$SCRIPTS/transifex-send-strings"
|
||||
|
||||
git diff-index --quiet HEAD locale || git commit locale -m "${COMMIT_PREFIX}Building locales"
|
||||
|
||||
echo ""
|
||||
status "****************************************************************************************"
|
||||
status "*** Preparing for actual release!! ***"
|
||||
status "****************************************************************************************"
|
||||
status "******************************************************************************"
|
||||
status "*** Preparing for actual release!! ***"
|
||||
status "******************************************************************************"
|
||||
echo ""
|
||||
echo -e " This is your ${RED}LAST CHANCE TO CANCEL${NORMAL}"
|
||||
echo -e "(Ctrl-C to cancel, ${BLUE}Enter${NORMAL} to continue)"
|
||||
read -r
|
||||
|
||||
|
||||
# 2.3 Check sphinx configuration (check the doc for version or things should not be there)
|
||||
|
|
@ -271,21 +274,25 @@ if ! grep -q " *${VERSION}$" docs/upgrade/index.rst; then
|
|||
}" docs/upgrade/index.rst
|
||||
fi
|
||||
|
||||
review CHANGELOG.rst
|
||||
review "${upgrade_doc}"
|
||||
review docs/upgrade/index.rst
|
||||
review docs/conf.py
|
||||
|
||||
#
|
||||
# commit documentations
|
||||
git diff-index --quiet HEAD docs CHANGELOG.rst || git commit -m "${COMMIT_PREFIX}updating latest docs" "${upgrade_doc}" CHANGELOG.rst docs/upgrade/index.rst docs/conf.py
|
||||
|
||||
# update the blog post using the What's new section
|
||||
status "Uploading to fork"
|
||||
git push -u origin "${BRANCH}"
|
||||
|
||||
status "Pushing to repo"
|
||||
git push --set-upstream origin "${BUILD_BRANCH}"
|
||||
echo ""
|
||||
success "Release process complete on the fork"
|
||||
echo ""
|
||||
echo -e "To complete the process:"
|
||||
echo -e "1. ${BLUE}Please create a Pull Request${NORMAL} from your fork to ${YELLOW}${BRANCH}${NORMAL}"
|
||||
echo -e "2. When the PR is merged in target branch, execute: ${BLUE}git tag ${TAG}; git push upstream ${TAG}"
|
||||
echo -e "3. Create a PR from ${BRANCH} to ${base_branch} then to develop when golden release is accepted"
|
||||
echo -e "1. Review"
|
||||
echo -e " * CHANGELOG.rst,"
|
||||
echo -e " * ${upgrade_doc},"
|
||||
echo -e " * docs/upgrade/index.rst, and"
|
||||
echo -e " * docs/conf.py"
|
||||
echo -e "2. Commit potential changes to ${YELLOW}${BUILD_BRANCH}${NORMAL}"
|
||||
echo -e "3. ${BLUE}Please create a Pull Request${NORMAL} from ${YELLOW}${BUILD_BRANCH}${NORMAL} to ${YELLOW}${BRANCH}${NORMAL}"
|
||||
echo -e "4. When the PR is merged in target branch, execute:"
|
||||
echo .e " ${BLUE}git tag ${TAG}; git push upstream ${TAG}"
|
||||
echo -e "5. Create a PR from ${BRANCH} to ${base_branch} then to develop when golden release is accepted"
|
||||
success "Enjoy!"
|
||||
|
|
|
|||
|
|
@ -10,8 +10,8 @@ check_command_exists python git awk sed pip npm xargs grep
|
|||
|
||||
check_virtual_env
|
||||
|
||||
status "- Installing needed python modules"
|
||||
grep -v django-cms docs/requirements.txt | grep -v '#' | xargs pip install --quiet django-admin transifex-client
|
||||
status "- Installing needed python modules (silent)"
|
||||
grep -v django-cms docs/requirements.txt | grep -v '#' | xargs pip install --quiet django-admin &>/dev/null
|
||||
|
||||
check_command_exists django-admin
|
||||
|
||||
|
|
@ -23,17 +23,22 @@ fi
|
|||
nvm_ver="$(cat .nvmrc)"
|
||||
|
||||
cd cms
|
||||
status "- Installing node/npm"
|
||||
|
||||
load_nvm
|
||||
|
||||
nvm install "${nvm_ver}"
|
||||
nvm use "${nvm_ver}"
|
||||
|
||||
status "- Installing required node packages"
|
||||
npm install --loglevel warn
|
||||
status "- Installing required node packages (silent)"
|
||||
npm install &>/dev/null
|
||||
|
||||
if ! command -v gulp; then
|
||||
npm install gulp@4.0.2 --loglevel warn
|
||||
check_command_exists gulp
|
||||
fi
|
||||
|
||||
status "- Installing transifex cli and gettext"
|
||||
( cd "$SCRIPTS" && curl -o- https://raw.githubusercontent.com/transifex/cli/master/install.sh | bash &>/dev/null )
|
||||
sudo apt-get -qq install gettext &>/dev/null
|
||||
|
||||
|
|
|
|||
|
|
@ -1,13 +1,13 @@
|
|||
#!/bin/bash
|
||||
|
||||
set -e
|
||||
set -e
|
||||
|
||||
SCRIPTS=$(dirname "$(realpath "$0")")
|
||||
ROOT=$(git rev-parse --show-toplevel)
|
||||
|
||||
cd "${ROOT}/cms"
|
||||
|
||||
tx pull -f
|
||||
"${SCRIPTS}/tx" --token "$TX_TOKEN" pull --force
|
||||
django-admin compilemessages
|
||||
|
||||
"${SCRIPTS}/filter-locale-changes"
|
||||
|
|
|
|||
|
|
@ -7,6 +7,6 @@ cd "${ROOT}/cms"
|
|||
django-admin makemessages -l en --no-location
|
||||
django-admin makemessages -l en -d djangojs --no-location
|
||||
|
||||
"${SCRIPTS}/filter-locale-changes"
|
||||
|
||||
tx push -s -l en
|
||||
"${SCRIPTS}/filter-locale-changes"
|
||||
"${SCRIPTS}/tx" --token "$TX_TOKEN" push -s --skip
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user