Skip to content

Commit

Permalink
ci(release): Adding release trigger (#25804)
Browse files Browse the repository at this point in the history
Refs: #25795

noop
  • Loading branch information
victoralfaro-dotcms authored Aug 16, 2023
1 parent 4e480f5 commit 1e5fb4d
Showing 1 changed file with 29 additions and 11 deletions.
40 changes: 29 additions & 11 deletions .github/workflows/release-trigger.yml
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}'

0 comments on commit 1e5fb4d

Please sign in to comment.