-
Notifications
You must be signed in to change notification settings - Fork 134
ci: fix nexus upload pipeline and release auto-trigger #2252
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
26f3b70
78fbcc4
59d2c53
fcea21a
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -98,11 +98,18 @@ jobs: | |||||||||||||||||||||||||
| echo "ERROR: '$TAG' is a pre-release tag. Only stable releases are uploaded to Nexus." >&2 | ||||||||||||||||||||||||||
| exit 1 | ||||||||||||||||||||||||||
| fi | ||||||||||||||||||||||||||
| DRAFT=$(gh api "repos/$GITHUB_REPOSITORY/releases" \ | ||||||||||||||||||||||||||
| --jq ".[] | select(.tag_name == \"$TAG\") | .draft" 2>/dev/null | head -1) | ||||||||||||||||||||||||||
| if [ "$DRAFT" != "false" ]; then | ||||||||||||||||||||||||||
| echo "ERROR: Release '$TAG' is not published. Publish the GitHub release before uploading to Nexus." >&2 | ||||||||||||||||||||||||||
| exit 1 | ||||||||||||||||||||||||||
| fi | ||||||||||||||||||||||||||
|
Comment on lines
+101
to
+106
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🧩 Analysis chain🏁 Script executed: cat -n .github/workflows/upload-nexus.yaml | sed -n '95,110p'Repository: community-shaders/skyrim-community-shaders Length of output: 1010 🏁 Script executed: cat -n .github/workflows/upload-nexus.yaml | sed -n '1,50p'Repository: community-shaders/skyrim-community-shaders Length of output: 2181 🏁 Script executed: wc -l .github/workflows/upload-nexus.yamlRepository: community-shaders/skyrim-community-shaders Length of output: 126 🏁 Script executed: # Check GitHub CLI documentation for releases endpoint behavior
gh api --help 2>&1 | head -50Repository: community-shaders/skyrim-community-shaders Length of output: 2767 🏁 Script executed: # Test what happens when gh api returns empty result
TEST_EMPTY=$(echo "" | head -1)
if [ "$TEST_EMPTY" != "false" ]; then
echo "Empty string test: condition is TRUE (empty != false)"
else
echo "Empty string test: condition is FALSE"
fi
# Test what the condition does with actual empty output
TEST_EMPTY2=$( { echo ""; } | head -1)
if [ "$TEST_EMPTY2" != "false" ]; then
echo "Empty output test: condition is TRUE"
else
echo "Empty output test: condition is FALSE"
fiRepository: community-shaders/skyrim-community-shaders Length of output: 177 🌐 Web query:
💡 Result: The default per_page for the GitHub REST API GET /repos/{owner}/{repo}/releases endpoint is 30. This is explicitly stated in the official GitHub documentation for the releases endpoint. The maximum per_page is 100. Pagination also supports a page parameter with default 1. Citations:
🌐 Web query:
💡 Result: The GitHub REST API endpoint GET /repos/{owner}/{repo}/releases/tags/{tag} retrieves a published release associated with the specified tag name. Path parameters: - owner (string, required): The account owner of the repository. The name is not case sensitive. - repo (string, required): The name of the repository without the .git extension. The name is not case sensitive. - tag (string, required): The tag name. HTTP method: GET Base URL: https://api.github.com Example: curl -L -X GET https://api.github.com/repos/OWNER/REPO/releases/tags/TAG Response: On success (200), returns the full release object (same schema as the "Create a release" endpoint), including fields like id, tag_name, name, body, author, assets, etc. This endpoint gets releases only; it does not return regular Git tags without an associated release. Use the Repository Tags API for plain tags. No authentication is strictly required for public repositories, but recommended for rate limits. Uses standard GitHub API headers like Accept: application/vnd.github+json. Citations:
Use the tag-specific release endpoint to avoid pagination issues. The list endpoint defaults to 30 items per page. When manually dispatched against older published tags (beyond the first page), the client-side filter fails to find the release, Suggested fix- DRAFT=$(gh api "repos/$GITHUB_REPOSITORY/releases" \
- --jq ".[] | select(.tag_name == \"$TAG\") | .draft" 2>/dev/null | head -1)
+ DRAFT=$(gh api "repos/$GITHUB_REPOSITORY/releases/tags/$TAG" \
+ --jq '.draft' 2>/dev/null)📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents |
||||||||||||||||||||||||||
| VERSION="${TAG#v}" | ||||||||||||||||||||||||||
| echo "tag=$TAG" >> $GITHUB_OUTPUT | ||||||||||||||||||||||||||
| echo "version=$VERSION" >> $GITHUB_OUTPUT | ||||||||||||||||||||||||||
| env: | ||||||||||||||||||||||||||
| INPUT_TAG: ${{ inputs.tag || '' }} | ||||||||||||||||||||||||||
| GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||
| - name: Compute dry-run mode | ||||||||||||||||||||||||||
| id: dryrun | ||||||||||||||||||||||||||
|
|
@@ -120,6 +127,7 @@ jobs: | |||||||||||||||||||||||||
| run: | | ||||||||||||||||||||||||||
| ARGS=( --export-nexus-matrix --matrix-output nexus-matrix-raw.json ) | ||||||||||||||||||||||||||
| PREVIOUS_TAG=$(git tag --merged "$RELEASE_TAG" --list 'v*.*.*' --sort=-v:refname 2>/dev/null \ | ||||||||||||||||||||||||||
| | grep -v -- '-' \ | ||||||||||||||||||||||||||
| | awk -v current="$RELEASE_TAG" '$0 != current { print; exit }') | ||||||||||||||||||||||||||
| if [ -n "$PREVIOUS_TAG" ]; then | ||||||||||||||||||||||||||
| ARGS+=( --base "$PREVIOUS_TAG" ) | ||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This published-release workflow still never performs the upload.
Because
.github/workflows/upload-nexus.yamlgatesupload-to-nexusondry_run != 'true'at Lines 245-247, this caller can only do the preview path. If the intent is to upload automatically after publish, this input needs to befalse.Suggested fix
with: tag: ${{ github.event.release.tag_name }} artifact_pattern: "CommunityShaders-*.7z" - dry_run: "true" + dry_run: "false"📝 Committable suggestion
🤖 Prompt for AI Agents