Skip to content

Commit 7d30a19

Browse files
committed
edit migrate releases yaml
1 parent 07d27b0 commit 7d30a19

File tree

1 file changed

+31
-37
lines changed

1 file changed

+31
-37
lines changed

.github/workflows/edit-releases.yml

Lines changed: 31 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -97,8 +97,6 @@ jobs:
9797
}
9898
9999
// Encode the output to handle multi-line strings correctly in GitHub Actions
100-
// The `gh` CLI for `--notes` generally handles newlines correctly, but encoding can prevent issues
101-
// if the content itself has unexpected characters.
102100
const encodedNotes = releaseNotes.replace(/%/g, '%25').replace(/\n/g, '%0A').replace(/\r/g, '%0D');
103101
console.log(`::set-output name=release_body::${encodedNotes}`);
104102
@@ -129,10 +127,10 @@ jobs:
129127
set -e
130128
131129
ALL_VERSIONS="${{ steps.get_tags.outputs.all_versions }}"
132-
130+
133131
# Filter versions based on optional inputs
134132
FILTERED_VERSIONS=""
135-
133+
136134
# Function for version comparison using sort -V (semantic versioning)
137135
version_ge() {
138136
local v1="$1"
@@ -157,51 +155,47 @@ jobs:
157155
continue # Skip if greater than end_version
158156
fi
159157
fi
160-
158+
161159
FILTERED_VERSIONS+=" $ver"
162160
done
163-
161+
164162
if [ -z "$FILTERED_VERSIONS" ]; then
165163
echo "No versions to edit after applying filters. Exiting."
166164
exit 0
167165
fi
168-
166+
169167
echo "Editing versions: $FILTERED_VERSIONS"
170168
171169
for VERSION in $FILTERED_VERSIONS; do
172170
echo "--- Processing version: $VERSION ---"
173171
174172
TAG="v$VERSION"
175-
173+
176174
# Construct the base installation instructions as a multi-line string within the script
177-
# Ensure proper indentation within this heredoc
178175
INSTALL_INSTRUCTIONS="## Installation
179-
\`\`\`bash
180-
# Latest version
181-
curl -L https://rindexer.xyz/install.sh | bash
182-
183-
# Specific version
184-
curl -L https://rindexer.xyz/install.sh | bash -s -- --version $VERSION
185-
\`\`\`"
186-
187-
# Call Node.js script to get release body.
188-
# This will now pass the 'raw' version (e.g., "0.1.0" or "0.21.0") to the JS script
189-
RAW_CHANGELOG_BODY=$(node parse_changelog.js "$VERSION")
190-
191-
# Decode the URL-encoded string from the Node.js script
192-
CLEANED_CHANGELOG_BODY=$(echo -e "${RAW_CHANGELOG_BODY//%/\\x}" | sed 's/%0A/\n/g; s/%0D/\r/g')
176+
\`\`\`bash
177+
# Latest version
178+
curl -L https://rindexer.xyz/install.sh | bash
179+
180+
# Specific version
181+
curl -L https://rindexer.xyz/install.sh | bash -s -- --version $VERSION
182+
\`\`\`"
183+
184+
# Call Node.js script to get release body.
185+
RAW_CHANGELOG_BODY=$(node parse_changelog.js "$VERSION")
186+
187+
# Decode the URL-encoded string from the Node.js script
188+
CLEANED_CHANGELOG_BODY=$(echo -e "${RAW_CHANGELOG_BODY//%/\\x}" | sed 's/%0A/\n/g; s/%0D/\r/g')
189+
190+
# Combine all parts for the full release body
191+
FULL_RELEASE_BODY="${INSTALL_INSTRUCTIONS}\n\n${CLEANED_CHANGELOG_BODY}\n\nSee full changelog for details: https://github.com/joshstevens19/rindexer/blob/master/documentation/docs/pages/docs/changelog.mdx"
192+
193+
echo "Attempting to edit release $TAG..."
194+
gh release edit "$TAG" \
195+
--prerelease=false \
196+
--notes "$FULL_RELEASE_BODY" \
197+
--target master # Assuming your release tags point to master/main
198+
# --draft=false # Uncomment this if you accidentally created drafts and want to publish them
193199
194-
# Combine all parts for the full release body
195-
# Assign this variable within the 'run:' block, correctly indented
196-
FULL_RELEASE_BODY="${INSTALL_INSTRUCTIONS}\n\n${CLEANED_CHANGELOG_BODY}\n\nSee full changelog for details: https://github.com/joshstevens19/rindexer/blob/master/documentation/docs/pages/docs/changelog.mdx"
197-
198-
echo "Attempting to edit release $TAG..."
199-
gh release edit "$TAG" \
200-
--prerelease=false \
201-
--notes "$FULL_RELEASE_BODY" \
202-
--discussion-category "Announcements" \
203-
--target master # Assuming your release tags point to master/main
204-
# --draft=false # If you accidentally created drafts, uncomment this to make them public
205-
206-
echo "Successfully edited release $TAG."
207-
done
200+
echo "Successfully edited release $TAG."
201+
done

0 commit comments

Comments
 (0)