Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/master' into release-24.05.13-ma…
Browse files Browse the repository at this point in the history
…ven-java-21, resolve conflicts
  • Loading branch information
swicken-dotcms committed Jun 19, 2024
2 parents 6621c8f + 85c6f33 commit 72d7e4a
Show file tree
Hide file tree
Showing 2 changed files with 66 additions and 0 deletions.
51 changes: 51 additions & 0 deletions .github/workflows/release-target.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
name: Plugins Release Target
on:
repository_dispatch:
types: [on-plugins-release]
workflow_dispatch:
inputs:
release_version:
description: 'Release Version (yy.mm.dd[_lts_v##]])'
required: false
jobs:
release:
runs-on: ubuntu-latest
steps:
- name: Checkout Repository
uses: actions/checkout@v4
with:
ref: master
fetch-depth: 0
- name: Setup Python
uses: actions/setup-python@v4
with:
python-version: '3.10'
- name: Create Release Branch
id: create-release-branch
run: |
release_version="${{ github.event.inputs.release_version }}"
[[ -z "${release_version}" ]] && release_version=${{ github.event.client_payload.release_version }}
release_branch=release-${release_version}
git config user.name "${{ secrets.CI_MACHINE_USER }}"
git config user.email "[email protected]"
git config pull.rebase false
remote=$(git ls-remote --heads https://github.com/dotCMS/plugin-seeds.git ${release_branch} | wc -l | tr -d '[:space:]')
if [[ "${remote}" == '1' && "${release_branch}" != 'master' ]]; then
echo "Release branch ${release_branch} already exists, removing it"
git push origin :${release_branch}
fi
git checkout -b ${release_branch}
for file in $(find . -name build.gradle)
do
echo "Replacing version for ${file}"
python3 ${{ github.workspace }}/update_osgi_plugins.py ${file} ${release_version}
cat ${file} | grep "${release_version}"
done
git status
git commit -a -m "Updating dotcms version to ${release_version}"
git push origin ${release_branch}
15 changes: 15 additions & 0 deletions update_osgi_plugins.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import sys
import re

plugin_file = sys.argv[1]
replacing_text = sys.argv[2]

with open(plugin_file, 'r') as fr:
content = fr.read()
content_new = re.sub('com.dotcms:dotcms:\d{2}\.\d{2}((\.\d{1,2})*)', 'com.dotcms:dotcms:' + replacing_text, content, flags = re.M)
content_new = re.sub('name: \'dotcms\', version: \'\d{2}\.\d{2}((\.\d{1,2})*)\'', 'name: \'dotcms\', version: \'' + replacing_text + '\'', content_new, flags = re.M)
fr.close()

with open(plugin_file, 'w') as fw:
fw.write(content_new)
fw.close()

0 comments on commit 72d7e4a

Please sign in to comment.