|
56 | 56 | # Configure git to use the token for authentication |
57 | 57 | git config --global url."https://x-access-token:${{ secrets.WAILS_REPO_TOKEN || github.token }}@github.com/".insteadOf "https://github.com/" |
58 | 58 |
|
59 | | - - name: Sync webview2 to latest release |
60 | | - # Ensure v3 always releases against the newest released webview2 module. |
61 | | - # Reads the latest webview2/v* tag; if v3/go.mod is behind, bumps it and |
62 | | - # adds a v3 changelog entry linking to the webview2 release notes (so they |
63 | | - # appear in the v3 release notes). Best-effort: a failure here must never |
64 | | - # block the v3 release — it just proceeds on the current version. |
65 | | - id: webview2_sync |
66 | | - run: | |
67 | | - set -e |
68 | | - LATEST_TAG=$(git tag -l "webview2/v*" | sort -V | tail -n 1) |
69 | | - if [ -z "$LATEST_TAG" ]; then |
70 | | - echo "No webview2 tag found — skipping." |
71 | | - exit 0 |
72 | | - fi |
73 | | - LATEST="${LATEST_TAG#webview2/}" |
74 | | - CURRENT=$(awk '/wailsapp\/wails\/webview2 /{print $2}' v3/go.mod | head -n1) |
75 | | - echo "webview2: current=$CURRENT latest=$LATEST" |
76 | | - if [ "$LATEST" = "$CURRENT" ]; then |
77 | | - echo "Already on latest webview2 ($CURRENT)." |
78 | | - exit 0 |
79 | | - fi |
80 | | - echo "Bumping webview2 $CURRENT -> $LATEST" |
81 | | - if ! (cd v3 && go get "github.com/wailsapp/wails/webview2@${LATEST}" && go mod tidy); then |
82 | | - echo "::warning::webview2 bump to ${LATEST} failed; continuing with ${CURRENT}" |
83 | | - git checkout -- v3/go.mod v3/go.sum 2>/dev/null || true |
84 | | - exit 0 |
85 | | - fi |
86 | | - # Reference the webview2 release notes by link rather than embedding |
87 | | - # them. Each webview2 release body uses its own heading style (some are |
88 | | - # hand-written with "### Fixes", others are flat auto-generated bullet |
89 | | - # lists), so inlining produced inconsistent, messy changelog entries. A |
90 | | - # single link is uniform and always points at the authoritative notes. |
91 | | - # The tag contains a slash ("webview2/vX.Y.Z"), so URL-encode it as %2F. |
92 | | - RELEASE_URL="https://github.com/${{ github.repository }}/releases/tag/webview2%2F${LATEST}" |
93 | | - INSERT="- Bump \`webview2\` to ${LATEST} ([release notes](${RELEASE_URL}))." |
94 | | - # Insert the notes under "## Changed". If that anchor is ever missing, |
95 | | - # append the section so the notes are never silently dropped. |
96 | | - if grep -q '^## Changed' v3/UNRELEASED_CHANGELOG.md; then |
97 | | - awk -v ins="$INSERT" ' |
98 | | - /^## Changed/ && !done { print; print ins; done=1; next } |
99 | | - { print } |
100 | | - ' v3/UNRELEASED_CHANGELOG.md > v3/UNRELEASED_CHANGELOG.md.tmp |
101 | | - mv v3/UNRELEASED_CHANGELOG.md.tmp v3/UNRELEASED_CHANGELOG.md |
102 | | - else |
103 | | - printf '\n## Changed\n%s\n' "$INSERT" >> v3/UNRELEASED_CHANGELOG.md |
104 | | - fi |
105 | | - git add v3/go.mod v3/go.sum v3/UNRELEASED_CHANGELOG.md |
106 | | - if git diff --cached --quiet; then |
107 | | - echo "No staged changes after bump — nothing to commit." |
108 | | - exit 0 |
109 | | - fi |
110 | | - # Commit/push are best-effort too: a failure here must not block the v3 |
111 | | - # release. Reset to the remote and continue on the current version. |
112 | | - if ! git commit -m "chore(v3): bump webview2 to ${LATEST}" || ! git push origin master; then |
113 | | - echo "::warning::webview2 sync commit/push failed; resetting and continuing without the bump" |
114 | | - git fetch origin master || true |
115 | | - git reset --hard origin/master || true |
116 | | - exit 0 |
117 | | - fi |
118 | | - echo "bumped=true" >> "$GITHUB_OUTPUT" |
119 | | -
|
120 | 59 | - name: Check for existing release tag |
121 | 60 | id: check_tag |
122 | 61 | run: | |
|
0 commit comments