diff --git a/.github/workflows/create-release-from-commit.yaml b/.github/workflows/create-release-from-commit.yaml new file mode 100644 index 0000000..ccdaf1d --- /dev/null +++ b/.github/workflows/create-release-from-commit.yaml @@ -0,0 +1,64 @@ +name: "Create Release Tag" + +on: + workflow_dispatch: + inputs: + version: + description: 'The new release tag to create (e.g., v3.8.1)' + required: true + type: string + commit_sha: + description: 'The short commit SHA from the calcom submodule to use for this release' + required: true + type: string + +jobs: + release: + name: "Tag Release" + runs-on: "ubuntu-latest" + + steps: + - name: "Checkout main branch to get starting point" + uses: "actions/checkout@v4" + with: + token: ${{ secrets.TOKEN_GITEA }} + # We check out main, but will create the release commit off of it + # without modifying the branch itself. + ref: 'main' + submodules: true + + - name: "Create Release Commit and Tag" + run: | + # Configure git user for the commit + git config user.email "actions@gitea.local" + git config user.name "Gitea Actions" + + echo "Updating submodule to commit ${{ inputs.commit_sha }}..." + + # Navigate into the submodule, fetch latest history, and check out the specific commit. + # This modifies the submodule's checked-out version in the working directory. + cd calcom + git fetch origin + git checkout ${{ inputs.commit_sha }} + cd .. + + # Stage the change to the submodule pointer. + git add calcom + + # Create a NEW commit. This commit is NOT on the main branch. + # It's a "dangling" commit that only HEAD is pointing to at this moment. + # The parent of this new commit is the latest commit from 'main'. + git commit -m "release: Version ${{ inputs.version }} with calcom at ${{ inputs.commit_sha }}" + + # Get the full SHA of the new commit we just created. + NEW_COMMIT_SHA=$(git rev-parse HEAD) + echo "Created new release commit: $NEW_COMMIT_SHA" + + echo "Creating and pushing tag ${{ inputs.version }}..." + + # Create an annotated tag pointing directly at our new, branchless commit. + git tag -a "${{ inputs.version }}" -m "Release ${{ inputs.version }}" $NEW_COMMIT_SHA + + # Push ONLY the new tag to the repository. Git will automatically send + # the required commit object ($NEW_COMMIT_SHA) along with the tag. + git push origin "${{ inputs.version }}" \ No newline at end of file