Skip to content

Conversation

@thomasturrell
Copy link
Contributor

Description

Resolves # (issue)

Checklist:

  • Public methods are documented
  • Public methods are tested
  • New and existing tests pass when run locally
  • There are no new warnings or errors

thomasturrell and others added 4 commits November 26, 2025 00:28
…blish draft releases (#427)

Co-authored-by: Copilot <198982749+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Copilot AI review requested due to automatic review settings November 26, 2025 02:31
Copy link

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

steps:
- name: Validate release tag format
id: validate_tag
run: |
TAG_NAME="${{ github.event.release.tag_name }}"

P1 Badge Restore build/publish steps in release workflow

The release workflow now stops after the initial tag validation; all subsequent steps that checkout the repo, generate a GitHub App token, run the Maven release goals, push tags/commits, and upload assets have been removed. With only the validation step remaining, any created draft release will succeed without building or deploying artifacts to Maven Central or publishing the GitHub release, effectively disabling automated releases.

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR updates the release.yml workflow by removing nearly all of its functional content (193 lines). The workflow now only validates the release tag format but no longer performs any of the actual release steps.

  • Removes all Maven release preparation and deployment logic
  • Removes Git operations for tagging and pushing changes
  • Removes artifact collection and GitHub release publishing steps

Comment on lines 49 to 52
# Check if a tag exists
if git ls-remote --tags origin | grep -q "refs/tags/$TAG_NAME$"; then
echo "::error::Tag $TAG_NAME already exists on remote."
exit 1
fi
echo "Pre-build checks passed. No issues detected."
- name: Set up JDK 25
uses: actions/setup-java@v5
with:
java-version: "25"
distribution: "temurin"
cache: maven
cache-dependency-path: |
pom.xml
xapi-model/pom.xml
xapi-client/pom.xml
xapi-model-spring-boot-starter/pom.xml
server-id: central
server-username: MAVEN_USERNAME
server-password: MAVEN_PASSWORD
gpg-private-key: ${{ secrets.MAVEN_GPG_PRIVATE_KEY }}
gpg-passphrase: MAVEN_GPG_PASSPHRASE
- name: Configure Git
run: |
git config user.name "github-actions[bot]"
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
- name: Run Maven release:prepare
run: |
VERSION="${{ steps.validate_tag.outputs.version }}"
TAG_NAME="${{ github.event.release.tag_name }}"
echo "Preparing release version: $VERSION"
echo "Tag name: $TAG_NAME"
./mvnw -B release:prepare \
-DreleaseVersion="${VERSION}" \
-Dtag="${TAG_NAME}" \
-DpushChanges=false \
-Darguments="-pl xapi-model,xapi-client,xapi-model-spring-boot-starter -am"
env:
MAVEN_USERNAME: ${{ secrets.OSSRH_USERNAME }}
MAVEN_PASSWORD: ${{ secrets.OSSRH_TOKEN }}
MAVEN_GPG_PASSPHRASE: ${{ secrets.MAVEN_GPG_PASSPHRASE }}

- name: Run Maven release:perform
run: |
echo "Performing release and deploying to Maven Central"
./mvnw -B release:perform \
-DlocalCheckout=true \
-DdeployAtEnd=true \
-Darguments="-pl xapi-model,xapi-client,xapi-model-spring-boot-starter -am"
env:
MAVEN_USERNAME: ${{ secrets.OSSRH_USERNAME }}
MAVEN_PASSWORD: ${{ secrets.OSSRH_TOKEN }}
MAVEN_GPG_PASSPHRASE: ${{ secrets.MAVEN_GPG_PASSPHRASE }}

- name: Push changes to originating branch and tag (with merge fallback)
run: |
TARGET_BRANCH="${{ steps.target_branch.outputs.target_branch }}"
TAG_NAME="${{ github.event.release.tag_name }}"
echo "Pushing changes to branch: $TARGET_BRANCH"
# First, try a normal fast-forward push
if git push origin "HEAD:${TARGET_BRANCH}"; then
echo "Fast-forward push to ${TARGET_BRANCH} succeeded."
else
echo "::warning::Fast-forward push to ${TARGET_BRANCH} failed. Trying merge fallback."
# Fetch latest state of the branch
git fetch origin "${TARGET_BRANCH}"
# Merge origin/TARGET_BRANCH into our release HEAD.
# If this conflicts, we bail out rather than trying to auto-resolve.
if ! git merge --no-edit "origin/${TARGET_BRANCH}"; then
echo "::error::Merge conflict detected - likely due to a race condition."
echo ""
echo "This typically happens when changes to POM files were merged to ${TARGET_BRANCH}"
echo "while this release workflow was running."
echo ""
echo "Recommended resolution:"
echo " 1. Delete this draft release in GitHub"
echo " 2. Create a new release via the GitHub Release UI"
echo ""
echo "Note: Artifacts have been deployed to Maven Central."
exit 1
fi
# Now push the merge commit
if git push origin "HEAD:${TARGET_BRANCH}"; then
echo "Pushed merge commit to ${TARGET_BRANCH}."
else
echo "::error::Failed to push merge commit to ${TARGET_BRANCH} after merge."
echo ""
echo "This may be due to branch protection rules or another race condition."
echo ""
echo "Recommended resolution:"
echo " 1. Delete this draft release in GitHub"
echo " 2. Create a new release via the GitHub Release UI"
exit 1
fi
fi
echo "Pushing tag $TAG_NAME"
if ! git push origin "$TAG_NAME"; then
echo "::error::Failed to push tag $TAG_NAME."
echo ""
echo "This may be due to concurrent tag creation (tag collision), where someone created a tag with"
echo "the same name while this workflow was running."
echo ""
echo "Recommended resolution:"
echo " 1. Check if the tag $TAG_NAME already exists on the remote"
echo " 2. If the tag exists but points to wrong commit, delete it"
echo " 3. Create a new draft release via the GitHub Release UI"
exit 1
fi
echo "Pushed release commits and tag to $TARGET_BRANCH"
- name: Collect release assets
run: |
set -e
VERSION="${{ steps.validate_tag.outputs.version }}"
mkdir -p artifacts
# Define artifact paths
CLIENT_JAR="xapi-client/target/xapi-client-${VERSION}.jar"
MODEL_JAR="xapi-model/target/xapi-model-${VERSION}.jar"
STARTER_JAR="xapi-model-spring-boot-starter/target/xapi-model-spring-boot-starter-${VERSION}.jar"
# Check existence and copy
for JAR in "$CLIENT_JAR" "$MODEL_JAR" "$STARTER_JAR"; do
if [ ! -f "$JAR" ]; then
echo "::error::Artifact not found: $JAR"
exit 1
fi
cp "$JAR" artifacts/
done
- name: Upload release assets
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
TAG_NAME="${{ github.event.release.tag_name }}"
for FILE in artifacts/*; do
echo "Uploading $(basename "$FILE")"
gh release upload "$TAG_NAME" "$FILE" --clobber
done
- name: Publish GitHub release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
TAG_NAME="${{ github.event.release.tag_name }}"
echo "Publishing draft release for $TAG_NAME"
gh release edit "$TAG_NAME" --draft=false
Copy link

Copilot AI Nov 26, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The release workflow has been gutted, removing all critical steps needed for the automated release process. After tag validation (line 47), the workflow now does nothing - it doesn't checkout code, build artifacts, deploy to Maven Central, push tags, or publish the GitHub release. This renders the entire workflow non-functional. The removed steps (lines 49-244) included: determining target branch, checking out repository, setting up JDK, running Maven release:prepare and release:perform, pushing changes and tags, collecting artifacts, uploading release assets, and publishing the GitHub release. These steps must be restored for the release automation to function.

Copilot uses AI. Check for mistakes.
echo "Publishing draft release for $TAG_NAME"
gh release edit "$TAG_NAME" --draft=false
Copy link

Copilot AI Nov 26, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Trailing whitespace should be removed. The file should end cleanly after the meaningful content.

Copilot uses AI. Check for mistakes.
@sonarqubecloud
Copy link

@thomasturrell
Copy link
Contributor Author

This is not possible, interestingly Copilot and Codex both assumed it was possible. Switching to a manual release strategy in later pull request.

@thomasturrell thomasturrell deleted the thomasturrell-patch-3 branch December 9, 2025 20:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants