diff --git a/.github/workflows/nightly-release-v3.yml b/.github/workflows/nightly-release-v3.yml index bfafb596d6b..f565a28fe9f 100644 --- a/.github/workflows/nightly-release-v3.yml +++ b/.github/workflows/nightly-release-v3.yml @@ -56,67 +56,6 @@ jobs: # Configure git to use the token for authentication git config --global url."https://x-access-token:${{ secrets.WAILS_REPO_TOKEN || github.token }}@github.com/".insteadOf "https://github.com/" - - name: Sync webview2 to latest release - # Ensure v3 always releases against the newest released webview2 module. - # Reads the latest webview2/v* tag; if v3/go.mod is behind, bumps it and - # adds a v3 changelog entry linking to the webview2 release notes (so they - # appear in the v3 release notes). Best-effort: a failure here must never - # block the v3 release — it just proceeds on the current version. - id: webview2_sync - run: | - set -e - LATEST_TAG=$(git tag -l "webview2/v*" | sort -V | tail -n 1) - if [ -z "$LATEST_TAG" ]; then - echo "No webview2 tag found — skipping." - exit 0 - fi - LATEST="${LATEST_TAG#webview2/}" - CURRENT=$(awk '/wailsapp\/wails\/webview2 /{print $2}' v3/go.mod | head -n1) - echo "webview2: current=$CURRENT latest=$LATEST" - if [ "$LATEST" = "$CURRENT" ]; then - echo "Already on latest webview2 ($CURRENT)." - exit 0 - fi - echo "Bumping webview2 $CURRENT -> $LATEST" - if ! (cd v3 && go get "github.com/wailsapp/wails/webview2@${LATEST}" && go mod tidy); then - echo "::warning::webview2 bump to ${LATEST} failed; continuing with ${CURRENT}" - git checkout -- v3/go.mod v3/go.sum 2>/dev/null || true - exit 0 - fi - # Reference the webview2 release notes by link rather than embedding - # them. Each webview2 release body uses its own heading style (some are - # hand-written with "### Fixes", others are flat auto-generated bullet - # lists), so inlining produced inconsistent, messy changelog entries. A - # single link is uniform and always points at the authoritative notes. - # The tag contains a slash ("webview2/vX.Y.Z"), so URL-encode it as %2F. - RELEASE_URL="https://github.com/${{ github.repository }}/releases/tag/webview2%2F${LATEST}" - INSERT="- Bump \`webview2\` to ${LATEST} ([release notes](${RELEASE_URL}))." - # Insert the notes under "## Changed". If that anchor is ever missing, - # append the section so the notes are never silently dropped. - if grep -q '^## Changed' v3/UNRELEASED_CHANGELOG.md; then - awk -v ins="$INSERT" ' - /^## Changed/ && !done { print; print ins; done=1; next } - { print } - ' v3/UNRELEASED_CHANGELOG.md > v3/UNRELEASED_CHANGELOG.md.tmp - mv v3/UNRELEASED_CHANGELOG.md.tmp v3/UNRELEASED_CHANGELOG.md - else - printf '\n## Changed\n%s\n' "$INSERT" >> v3/UNRELEASED_CHANGELOG.md - fi - git add v3/go.mod v3/go.sum v3/UNRELEASED_CHANGELOG.md - if git diff --cached --quiet; then - echo "No staged changes after bump — nothing to commit." - exit 0 - fi - # Commit/push are best-effort too: a failure here must not block the v3 - # release. Reset to the remote and continue on the current version. - if ! git commit -m "chore(v3): bump webview2 to ${LATEST}" || ! git push origin master; then - echo "::warning::webview2 sync commit/push failed; resetting and continuing without the bump" - git fetch origin master || true - git reset --hard origin/master || true - exit 0 - fi - echo "bumped=true" >> "$GITHUB_OUTPUT" - - name: Check for existing release tag id: check_tag run: | diff --git a/.github/workflows/release-webview2.yml b/.github/workflows/release-webview2.yml deleted file mode 100644 index 11441f1ea50..00000000000 --- a/.github/workflows/release-webview2.yml +++ /dev/null @@ -1,186 +0,0 @@ -name: Release webview2 - -# Tags and releases the `webview2` Go module when its source changes. -# -# Runs nightly and only cuts a new tag if there have been changes under -# `webview2/` since the most recent `webview2/v*` tag — quiet days are a no-op. -# The v3 side is bumped by the nightly v3 release workflow, which reads the -# latest `webview2/v*` tag, updates `v3/go.mod`, and folds the webview2 release -# notes into the v3 release notes. - -on: - schedule: - - cron: '0 13 * * *' # 13:00 UTC nightly — ahead of the v3 nightly (15:00 UTC) - workflow_dispatch: - inputs: - version: - description: 'Version to release (e.g., v1.0.27). Leave empty to auto-increment.' - required: false - type: string - force: - description: 'Release even if webview2/ has no changes since the last tag' - required: false - default: false - type: boolean - -permissions: - contents: write - -# Serialise releases so two runs can't race on computing/pushing the same tag. -concurrency: - group: release-webview2 - cancel-in-progress: false - -jobs: - release: - runs-on: ubuntu-latest - env: - GOWORK: "off" - - steps: - - name: Checkout code - uses: actions/checkout@v4 - with: - fetch-depth: 0 - - - name: Setup Go - uses: actions/setup-go@v5 - with: - go-version: '1.25' - cache: true - cache-dependency-path: "webview2/go.sum" - - - name: Detect changes since last tag - id: changes - run: | - LAST_TAG=$(git tag -l "webview2/v*" | sort -V | tail -n 1) - echo "last_tag=$LAST_TAG" >> "$GITHUB_OUTPUT" - if [ -z "$LAST_TAG" ]; then - echo "No existing webview2 tag — first release." - echo "changed=true" >> "$GITHUB_OUTPUT" - elif [ "${{ inputs.force }}" = "true" ]; then - echo "force=true — releasing regardless of changes." - echo "changed=true" >> "$GITHUB_OUTPUT" - elif git diff --quiet "$LAST_TAG" HEAD -- webview2/; then - echo "No changes under webview2/ since $LAST_TAG — skipping release." - echo "changed=false" >> "$GITHUB_OUTPUT" - else - echo "Changes detected under webview2/ since $LAST_TAG." - echo "changed=true" >> "$GITHUB_OUTPUT" - fi - - - name: Determine next version - id: version - if: steps.changes.outputs.changed == 'true' - env: - # Pass the dispatch input through env (never interpolate it directly - # into the shell) and validate it, so a crafted value can't inject - # commands into a step that runs with contents: write. - INPUT_VERSION: ${{ inputs.version }} - run: | - if [ -n "$INPUT_VERSION" ]; then - if [[ ! "$INPUT_VERSION" =~ ^v[0-9]+\.[0-9]+\.[0-9]+$ ]]; then - echo "::error::version must match vMAJOR.MINOR.PATCH, e.g. v1.0.27" - exit 1 - fi - VERSION="$INPUT_VERSION" - else - LAST_TAG="${{ steps.changes.outputs.last_tag }}" - if [ -z "$LAST_TAG" ]; then - VERSION="v1.0.24" - else - # Strip the "webview2/v" prefix so MAJOR is the bare number (e.g. 1), - # not "v1" — otherwise the version string would become vv1.0.x. - LAST_VERSION=${LAST_TAG#webview2/v} - MAJOR=$(echo "$LAST_VERSION" | cut -d. -f1) - MINOR=$(echo "$LAST_VERSION" | cut -d. -f2) - PATCH=$(echo "$LAST_VERSION" | cut -d. -f3) - PATCH=$((PATCH + 1)) - VERSION="v${MAJOR}.${MINOR}.${PATCH}" - fi - fi - echo "version=$VERSION" >> "$GITHUB_OUTPUT" - echo "Releasing webview2 at version: $VERSION" - - - name: Build webview2 (cross-compile for Windows) - if: steps.changes.outputs.changed == 'true' - working-directory: webview2 - env: - # webview2 is Windows-only code, so it can't build (or run tests) on - # the ubuntu runner natively — cross-compile for Windows as the gate. - GOOS: windows - run: | - go mod download - go build ./... - - - name: Generate release notes - if: steps.changes.outputs.changed == 'true' - run: | - LAST_TAG="${{ steps.changes.outputs.last_tag }}" - VERSION="${{ steps.version.outputs.version }}" - # Drop internal-only commits (pipeline, chores, build/test plumbing) - # from the user-facing notes. The conventional-commit type is matched - # case-insensitively, tolerating an optional "(scope)" and breaking - # "!". Keep this set in sync with internalTypes in - # v3/scripts/auto-changelog.go. `|| true` so pipefail doesn't kill the - # step when grep filters everything out (no match -> exit 1). - INTERNAL_RE='^(ci|chore|build|test|style)(\([^)]*\))?!?:' - if [ -n "$LAST_TAG" ]; then - RANGE="${LAST_TAG}..HEAD" - else - RANGE="HEAD" - fi - NOTES=$(git log --no-merges --pretty='%s' $RANGE -- webview2/ \ - | grep -viE "$INTERNAL_RE" | sed 's/^/- /' | head -n 50 || true) - [ -z "$NOTES" ] && NOTES="- Maintenance release (no user-facing changes)." - { - echo "## webview2 ${VERSION}" - echo "" - echo "$NOTES" - if [ -n "$LAST_TAG" ]; then - echo "" - echo "**Full diff:** https://github.com/${{ github.repository }}/compare/${LAST_TAG}...webview2/${VERSION}" - fi - } > release-notes.md - echo "----- generated release notes -----" - cat release-notes.md - - - name: Create and push tag - if: steps.changes.outputs.changed == 'true' - run: | - git config user.name "github-actions[bot]" - git config user.email "github-actions[bot]@users.noreply.github.com" - git tag -a "webview2/${{ steps.version.outputs.version }}" -m "Release webview2 ${{ steps.version.outputs.version }}" - git push origin "webview2/${{ steps.version.outputs.version }}" - - - name: Create GitHub release - id: github_release - if: steps.changes.outputs.changed == 'true' - env: - GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} - run: | - gh release create "webview2/${{ steps.version.outputs.version }}" \ - --repo "${{ github.repository }}" \ - --title "webview2 ${{ steps.version.outputs.version }}" \ - --notes-file release-notes.md \ - --latest=false - - - name: Summary - if: always() - run: | - if [ "${{ steps.github_release.outcome }}" = "success" ]; then - { - echo "## 🚀 Released webview2 ${{ steps.version.outputs.version }}" - echo "Changes since ${{ steps.changes.outputs.last_tag }}. The v3 nightly release will pick up the new tag." - } >> "$GITHUB_STEP_SUMMARY" - elif [ "${{ steps.changes.outputs.changed }}" = "true" ]; then - { - echo "## ❌ webview2 release failed" - echo "Changes were detected since ${{ steps.changes.outputs.last_tag }}, but the release did not complete — check the failed step above." - } >> "$GITHUB_STEP_SUMMARY" - else - { - echo "## ℹ️ No webview2 release" - echo "No changes under \`webview2/\` since ${{ steps.changes.outputs.last_tag }}." - } >> "$GITHUB_STEP_SUMMARY" - fi