Update update-version.yml
This commit is contained in:
@@ -12,6 +12,9 @@ on:
|
|||||||
default: 'false'
|
default: 'false'
|
||||||
type: boolean
|
type: boolean
|
||||||
|
|
||||||
|
# Dynamic run name with version
|
||||||
|
run-name: "Update WhatsApp Version ${{ github.run_number }}"
|
||||||
|
|
||||||
permissions:
|
permissions:
|
||||||
contents: write
|
contents: write
|
||||||
pull-requests: write
|
pull-requests: write
|
||||||
@@ -78,6 +81,12 @@ jobs:
|
|||||||
|
|
||||||
echo "exit_code=$EXIT_CODE" >> $GITHUB_OUTPUT
|
echo "exit_code=$EXIT_CODE" >> $GITHUB_OUTPUT
|
||||||
|
|
||||||
|
# Read and output the updated version
|
||||||
|
VERSION=$(cat src/Defaults/baileys-version.json | grep -oP '"version":\s*\[\s*\K[0-9,\s]+' | tr -d ' ')
|
||||||
|
VERSION_STRING=$(echo $VERSION | sed 's/,/./g')
|
||||||
|
echo "version=$VERSION_STRING" >> $GITHUB_OUTPUT
|
||||||
|
echo "📱 WhatsApp Version: $VERSION_STRING"
|
||||||
|
|
||||||
# Only fail on fatal errors (exit code 1)
|
# Only fail on fatal errors (exit code 1)
|
||||||
if [ $EXIT_CODE -eq 1 ]; then
|
if [ $EXIT_CODE -eq 1 ]; then
|
||||||
echo "::error::Script failed with fatal error"
|
echo "::error::Script failed with fatal error"
|
||||||
@@ -115,6 +124,7 @@ jobs:
|
|||||||
run: |
|
run: |
|
||||||
BRANCH_NAME="update-version/stable"
|
BRANCH_NAME="update-version/stable"
|
||||||
FORCE="${{ inputs.force }}"
|
FORCE="${{ inputs.force }}"
|
||||||
|
VERSION="${{ steps.update_version.outputs.version }}"
|
||||||
|
|
||||||
# Configure git
|
# Configure git
|
||||||
git config user.name "github-actions[bot]"
|
git config user.name "github-actions[bot]"
|
||||||
@@ -133,16 +143,19 @@ jobs:
|
|||||||
if [ "$FORCE" == "true" ] && git diff --cached --quiet; then
|
if [ "$FORCE" == "true" ] && git diff --cached --quiet; then
|
||||||
git commit --allow-empty -m "chore: force WhatsApp Web version check"
|
git commit --allow-empty -m "chore: force WhatsApp Web version check"
|
||||||
else
|
else
|
||||||
git commit -m "chore: update WhatsApp Web version"
|
git commit -m "chore: update WhatsApp Web version to v$VERSION"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
git push origin "$BRANCH_NAME"
|
git push origin "$BRANCH_NAME"
|
||||||
|
|
||||||
# Create PR using GitHub CLI
|
# Create PR using GitHub CLI with version in title
|
||||||
|
PR_TITLE="chore: update WhatsApp Web version to v$VERSION"
|
||||||
PR_BODY="Automated WhatsApp Web version update.
|
PR_BODY="Automated WhatsApp Web version update.
|
||||||
|
|
||||||
This PR updates the WhatsApp Web client revision to the latest version fetched from \`web.whatsapp.com\`.
|
This PR updates the WhatsApp Web client revision to the latest version fetched from \`web.whatsapp.com\`.
|
||||||
|
|
||||||
|
**Version:** \`$VERSION\`
|
||||||
|
|
||||||
**Single source of truth:**
|
**Single source of truth:**
|
||||||
- \`src/Defaults/baileys-version.json\` (other files import from here)
|
- \`src/Defaults/baileys-version.json\` (other files import from here)
|
||||||
|
|
||||||
@@ -157,7 +170,7 @@ jobs:
|
|||||||
# Create PR (compatible with older gh CLI versions)
|
# Create PR (compatible with older gh CLI versions)
|
||||||
set +e
|
set +e
|
||||||
PR_URL=$(gh pr create \
|
PR_URL=$(gh pr create \
|
||||||
--title "chore: update WhatsApp Web version" \
|
--title "$PR_TITLE" \
|
||||||
--body "$PR_BODY" \
|
--body "$PR_BODY" \
|
||||||
--base master \
|
--base master \
|
||||||
--head "$BRANCH_NAME" 2>&1)
|
--head "$BRANCH_NAME" 2>&1)
|
||||||
@@ -283,6 +296,10 @@ jobs:
|
|||||||
EXIT_CODE="${{ steps.update_version.outputs.exit_code }}"
|
EXIT_CODE="${{ steps.update_version.outputs.exit_code }}"
|
||||||
HAS_CHANGES="${{ steps.check_changes.outputs.has_changes }}"
|
HAS_CHANGES="${{ steps.check_changes.outputs.has_changes }}"
|
||||||
FORCE_MODE="${{ steps.check_changes.outputs.force_mode }}"
|
FORCE_MODE="${{ steps.check_changes.outputs.force_mode }}"
|
||||||
|
VERSION="${{ steps.update_version.outputs.version }}"
|
||||||
|
|
||||||
|
echo "**Version:** \`$VERSION\`" >> $GITHUB_STEP_SUMMARY
|
||||||
|
echo "" >> $GITHUB_STEP_SUMMARY
|
||||||
|
|
||||||
if [ "$EXIT_CODE" == "2" ]; then
|
if [ "$EXIT_CODE" == "2" ]; then
|
||||||
echo "⚠️ Warning: Could not fetch latest version from WhatsApp servers" >> $GITHUB_STEP_SUMMARY
|
echo "⚠️ Warning: Could not fetch latest version from WhatsApp servers" >> $GITHUB_STEP_SUMMARY
|
||||||
|
|||||||
Reference in New Issue
Block a user