-
Notifications
You must be signed in to change notification settings - Fork 467
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ci(release): Adding release trigger (#25804)
Refs: #25795 noop
- Loading branch information
1 parent
4e480f5
commit 1e5fb4d
Showing
1 changed file
with
29 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,34 +1,52 @@ | ||
name: Automated Release Process | ||
name: Release Trigger | ||
|
||
on: | ||
workflow_dispatch: | ||
inputs: | ||
release_version: | ||
description: 'Release Version' | ||
description: 'Release Version (yy.mm.dd)' | ||
required: true | ||
commit_hash: | ||
description: 'Commit Hash' | ||
required: true | ||
|
||
jobs: | ||
release: | ||
release-trigger: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Checkout Repository | ||
uses: actions/checkout@v2 | ||
uses: actions/checkout@v3 | ||
with: | ||
ref: master | ||
fetch-depth: 0 | ||
|
||
- name: Create Release Branch | ||
run: | | ||
git config user.name "GitHub Actions" | ||
git config user.email "[email protected]" | ||
git checkout -b release/${{ github.event.inputs.release_version }} | ||
git push origin release/${{ github.event.inputs.release_version }} | ||
remote=$(git ls-remote --heads https://github.com/dotCMS/core.git release-${{ github.event.inputs.release_version }} | wc -l | tr -d '[:space:]') | ||
[[ "${remote}" == '1' ]] && git push origin :release-${{ github.event.inputs.release_version }} | ||
git reset --hard ${{ github.event.inputs.commit_hash }} | ||
git checkout -b release-${{ github.event.inputs.release_version }} | ||
git push origin release-${{ github.event.inputs.release_version }} | ||
- name: Modify gradle.properties | ||
run: | | ||
sed -i 's/dotCmsReleaseVersion=.*/dotCmsReleaseVersion=${{ github.event.inputs.release_version }}/' gradle.properties | ||
sed -i 's/dotcmsReleaseVersion=.*/dotcmsReleaseVersion=${{ github.event.inputs.release_version }}/' dotCMS/gradle.properties | ||
git commit -am "Update dotCmsReleaseVersion to ${{ github.event.inputs.release_version }}" | ||
git push origin release/${{ github.event.inputs.release_version }} | ||
RELEASE_COMMIT=$(git log -1 --pretty=%H) | ||
echo "RELEASE_COMMIT: ${RELEASE_COMMIT}" | ||
git push origin release-${{ github.event.inputs.release_version }} | ||
echo "RELEASE_COMMIT=${RELEASE_COMMIT}" >> $GITHUB_ENV | ||
- name: Trigger Automated Release | ||
- name: Create Release | ||
run: | | ||
# Replace with actual command to trigger the automated release process | ||
# Example: curl -X POST https://api.github.com/repos/dotCMS/core/releases -H "Authorization: token <your_access_token>" | ||
curl -X POST \ | ||
-H "Accept: application/vnd.github+json" \ | ||
-H "X-GitHub-Api-Version: 2022-11-28" \ | ||
-H "Authorization: Bearer ${{ secrets.CICD_GITHUB_TOKEN }}" \ | ||
https://api.github.com/repos/dotCMS/core/releases \ | ||
-d '{"tag_name": "v${{ github.event.inputs.release_version }}", "name": "Release ${{ github.event.inputs.release_version }}", "target_commitish": "${{ env.RELEASE_COMMIT }}", "draft": false, "prerelease": false, "generate_release_notes": false}' |