diff --git a/.github/workflows/nightly-release-v3.yml b/.github/workflows/nightly-release-v3.yml index 2ca6b4811..5f5c06ee8 100644 --- a/.github/workflows/nightly-release-v3.yml +++ b/.github/workflows/nightly-release-v3.yml @@ -27,740 +27,737 @@ jobs: actions: write steps: - - name: Checkout code - uses: actions/checkout@v4 - with: - ref: v3-alpha - fetch-depth: 0 - token: ${{ secrets.WAILS_REPO_TOKEN || github.token }} - - - name: Setup Go - uses: actions/setup-go@v5 - with: - go-version: '1.23' - cache-dependency-path: 'v3/go.sum' - - - name: Install Task - uses: arduino/setup-task@v2 - with: - version: 3.x - repo-token: ${{ secrets.WAILS_REPO_TOKEN || github.token }} - - - name: Verify Go and Task installation - run: | - echo "Go version:" - go version - echo "" - echo "Task version:" - task --version - echo "" - echo "Working directory:" - pwd - echo "" - echo "v3 directory contents:" - ls -la v3/ - - - name: Setup Git - run: | - git config --global user.name "github-actions[bot]" - git config --global user.email "github-actions[bot]@users.noreply.github.com" - - # 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: Check for existing release tag - id: check_tag - run: | - if git describe --tags --exact-match HEAD 2>/dev/null; then - echo "has_tag=true" >> $GITHUB_OUTPUT - echo "tag=$(git describe --tags --exact-match HEAD)" >> $GITHUB_OUTPUT - else - echo "has_tag=false" >> $GITHUB_OUTPUT - echo "tag=" >> $GITHUB_OUTPUT - fi - - - name: Check for unreleased changelog content - id: changelog_check - run: | - echo "๐Ÿ” Checking UNRELEASED_CHANGELOG.md for content..." - - # Check if the file exists and has content - if [ -f "v3/UNRELEASED_CHANGELOG.md" ]; then - echo "Found v3/UNRELEASED_CHANGELOG.md" - - # Run the release script in check mode to see if there's content - cd v3/tasks/release - - # Use the release script itself to check for content - if go run release.go --check-only 2>/dev/null; then - echo "has_unreleased_content=true" >> $GITHUB_OUTPUT - echo "โœ… Found unreleased changelog content" - else - echo "has_unreleased_content=false" >> $GITHUB_OUTPUT - echo "โ„น๏ธ No unreleased changelog content found" - fi - else - echo "โš ๏ธ v3/UNRELEASED_CHANGELOG.md not found" - echo "has_unreleased_content=false" >> $GITHUB_OUTPUT - fi + - name: Checkout code + uses: actions/checkout@v4 + with: + ref: v3-alpha + fetch-depth: 0 + token: ${{ secrets.WAILS_REPO_TOKEN || github.token }} - - name: Quick change detection and early exit - id: quick_check - run: | - echo "๐Ÿ” Quick check for changes to determine if we should continue..." - - # First check if we have unreleased changelog content - if [ "${{ steps.changelog_check.outputs.has_unreleased_content }}" == "true" ]; then - echo "โœ… Found unreleased changelog content, proceeding with release" - echo "has_changes=true" >> $GITHUB_OUTPUT - echo "should_continue=true" >> $GITHUB_OUTPUT - echo "reason=Found unreleased changelog content" >> $GITHUB_OUTPUT - exit 0 - fi - - # If no unreleased changelog content, check for git changes as fallback - echo "No unreleased changelog content found, checking for git changes..." - - # Check if current commit has a release tag - if git describe --tags --exact-match HEAD 2>/dev/null; then - CURRENT_TAG=$(git describe --tags --exact-match HEAD) - echo "Current commit has release tag: $CURRENT_TAG" + - name: Setup Go + uses: actions/setup-go@v5 + with: + go-version: '1.23' + cache-dependency-path: 'v3/go.sum' + + - name: Install Task + uses: arduino/setup-task@v2 + with: + version: 3.x + repo-token: ${{ secrets.GITHUB_TOKEN }} + + - name: Verify Go and Task installation + run: | + echo "Go version:" + go version + echo "" + echo "Task version:" + task --version + echo "" + echo "Working directory:" + pwd + echo "" + echo "v3 directory contents:" + ls -la v3/ + + - name: Setup Git + run: | + git config --global user.name "github-actions[bot]" + git config --global user.email "github-actions[bot]@users.noreply.github.com" - # For tagged commits, check if there are changes since the tag - COMMIT_COUNT=$(git rev-list ${CURRENT_TAG}..HEAD --count) - if [ "$COMMIT_COUNT" -eq 0 ]; then - echo "has_changes=false" >> $GITHUB_OUTPUT - echo "should_continue=false" >> $GITHUB_OUTPUT - echo "reason=No changes since existing tag $CURRENT_TAG and no unreleased changelog content" >> $GITHUB_OUTPUT + # 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: Check for existing release tag + id: check_tag + run: | + if git describe --tags --exact-match HEAD 2>/dev/null; then + echo "has_tag=true" >> $GITHUB_OUTPUT + echo "tag=$(git describe --tags --exact-match HEAD)" >> $GITHUB_OUTPUT else - echo "has_changes=true" >> $GITHUB_OUTPUT - echo "should_continue=true" >> $GITHUB_OUTPUT + echo "has_tag=false" >> $GITHUB_OUTPUT + echo "tag=" >> $GITHUB_OUTPUT fi - else - # No current tag, check against latest release - LATEST_TAG=$(git tag --list "v3.0.0-alpha.*" | sort -V | tail -1) - if [ -z "$LATEST_TAG" ]; then - echo "No previous release found, proceeding with release" + + - name: Check for unreleased changelog content + id: changelog_check + run: | + echo "๐Ÿ” Checking UNRELEASED_CHANGELOG.md for content..." + + # Check if the file exists and has content + if [ -f "v3/UNRELEASED_CHANGELOG.md" ]; then + echo "Found v3/UNRELEASED_CHANGELOG.md" + + # Run the release script in check mode to see if there's content + cd v3/tasks/release + + # Use the release script itself to check for content + if go run release.go --check-only 2>/dev/null; then + echo "has_unreleased_content=true" >> $GITHUB_OUTPUT + echo "โœ… Found unreleased changelog content" + else + echo "has_unreleased_content=false" >> $GITHUB_OUTPUT + echo "โ„น๏ธ No unreleased changelog content found" + fi + else + echo "โš ๏ธ v3/UNRELEASED_CHANGELOG.md not found" + echo "has_unreleased_content=false" >> $GITHUB_OUTPUT + fi + + - name: Quick change detection and early exit + id: quick_check + run: | + echo "๐Ÿ” Quick check for changes to determine if we should continue..." + + # First check if we have unreleased changelog content + if [ "${{ steps.changelog_check.outputs.has_unreleased_content }}" == "true" ]; then + echo "โœ… Found unreleased changelog content, proceeding with release" echo "has_changes=true" >> $GITHUB_OUTPUT echo "should_continue=true" >> $GITHUB_OUTPUT + echo "reason=Found unreleased changelog content" >> $GITHUB_OUTPUT + exit 0 + fi + + # If no unreleased changelog content, check for git changes as fallback + echo "No unreleased changelog content found, checking for git changes..." + + # Check if current commit has a release tag + if git describe --tags --exact-match HEAD 2>/dev/null; then + CURRENT_TAG=$(git describe --tags --exact-match HEAD) + echo "Current commit has release tag: $CURRENT_TAG" + + # For tagged commits, check if there are changes since the tag + COMMIT_COUNT=$(git rev-list ${CURRENT_TAG}..HEAD --count) + if [ "$COMMIT_COUNT" -eq 0 ]; then + echo "has_changes=false" >> $GITHUB_OUTPUT + echo "should_continue=false" >> $GITHUB_OUTPUT + echo "reason=No changes since existing tag $CURRENT_TAG and no unreleased changelog content" >> $GITHUB_OUTPUT + else + echo "has_changes=true" >> $GITHUB_OUTPUT + echo "should_continue=true" >> $GITHUB_OUTPUT + fi else - COMMIT_COUNT=$(git rev-list ${LATEST_TAG}..HEAD --count) - if [ "$COMMIT_COUNT" -gt 0 ]; then - echo "Found $COMMIT_COUNT commits since $LATEST_TAG" + # No current tag, check against latest release + LATEST_TAG=$(git tag --list "v3.0.0-alpha.*" | sort -V | tail -1) + if [ -z "$LATEST_TAG" ]; then + echo "No previous release found, proceeding with release" echo "has_changes=true" >> $GITHUB_OUTPUT echo "should_continue=true" >> $GITHUB_OUTPUT else - echo "has_changes=false" >> $GITHUB_OUTPUT - echo "should_continue=false" >> $GITHUB_OUTPUT - echo "reason=No changes since latest release $LATEST_TAG and no unreleased changelog content" >> $GITHUB_OUTPUT - fi - fi - fi - - - name: Early exit - No changes detected - if: | - steps.quick_check.outputs.should_continue == 'false' && - github.event.inputs.force_release != 'true' - run: | - echo "๐Ÿ›‘ EARLY EXIT: ${{ steps.quick_check.outputs.reason }}" - echo "" - echo "โ„น๏ธ No changes detected since last release and force_release is not enabled." - echo " Workflow will exit early to save resources." - echo "" - echo " To force a release anyway, run this workflow with 'force_release=true'" - echo "" - echo "## ๐Ÿ›‘ Early Exit Summary" >> $GITHUB_STEP_SUMMARY - echo "**Reason:** ${{ steps.quick_check.outputs.reason }}" >> $GITHUB_STEP_SUMMARY - echo "**Action:** Workflow exited early to save resources" >> $GITHUB_STEP_SUMMARY - echo "**Force Release:** Set 'force_release=true' to override this behavior" >> $GITHUB_STEP_SUMMARY - exit 0 - - - name: Continue with release process - if: | - steps.quick_check.outputs.should_continue == 'true' || - github.event.inputs.force_release == 'true' - run: | - echo "โœ… Proceeding with release process..." - if [ "${{ github.event.inputs.force_release }}" == "true" ]; then - echo "๐Ÿ”จ FORCE RELEASE: Overriding change detection" - fi - - - name: Extract changelog content before release - id: extract_changelog - if: | - steps.quick_check.outputs.should_continue == 'true' || - github.event.inputs.force_release == 'true' - run: | - cd v3 - - echo "๐Ÿ“ Extracting changelog content before release..." - - # Use the new --create-release-notes flag - cd tasks/release - if go run release.go --create-release-notes ../../release_notes.md; then - echo "โœ… Successfully created release notes" - echo "has_content=true" >> $GITHUB_OUTPUT - - # Show content preview - echo "Release notes preview:" - head -10 ../../release_notes.md - else - echo "โš ๏ธ Failed to create release notes or no content found" - echo "No changelog updates in this release." > ../../release_notes.md - echo "has_content=false" >> $GITHUB_OUTPUT - fi - cd ../.. - - - name: Run release script - id: release - if: | - steps.quick_check.outputs.should_continue == 'true' || - github.event.inputs.force_release == 'true' - run: | - cd v3 - - echo "๐Ÿš€ Running release task..." - echo "=======================================================" - - # Initialize error tracking - RELEASE_ERRORS="" - RELEASE_SUCCESS=true - - # Store the original version for comparison - ORIGINAL_VERSION=$(cat internal/version/version.txt 2>/dev/null || echo "unknown") - echo "๐Ÿ“Œ Current version: $ORIGINAL_VERSION" - - # Run the release task and capture output with error handling - if [ "${{ github.event.inputs.dry_run }}" == "true" ]; then - echo "๐Ÿงช DRY RUN MODE: Simulating release task execution" - # In dry run, we'll simulate the task without making actual changes - OUTPUT=$(task release 2>&1 || true) - RELEASE_EXIT_CODE=0 # Always succeed in dry run - echo "$OUTPUT" - else - echo "๐Ÿš€ LIVE MODE: Executing release task" - OUTPUT=$(task release 2>&1) - RELEASE_EXIT_CODE=$? - echo "$OUTPUT" - - if [ $RELEASE_EXIT_CODE -ne 0 ]; then - echo "โŒ Release task failed with exit code $RELEASE_EXIT_CODE" - RELEASE_ERRORS="$RELEASE_ERRORS\n- Release task execution failed: $OUTPUT" - RELEASE_SUCCESS=false - else - echo "โœ… Release task completed successfully" - fi - fi - - # Verify version file exists and is readable - if [ ! -f "internal/version/version.txt" ]; then - echo "โŒ Version file not found: internal/version/version.txt" - RELEASE_ERRORS="$RELEASE_ERRORS\n- Version file not found after release task execution" - RELEASE_SUCCESS=false - RELEASE_VERSION="unknown" - else - RELEASE_VERSION=$(cat internal/version/version.txt 2>/dev/null || echo "unknown") - if [ "$RELEASE_VERSION" == "unknown" ]; then - echo "โŒ Failed to read version from file" - RELEASE_ERRORS="$RELEASE_ERRORS\n- Failed to read version from version.txt" - RELEASE_SUCCESS=false - else - echo "โœ… Successfully read version: $RELEASE_VERSION" - fi - fi - - # Check if version changed - VERSION_CHANGED="false" - if [ "$ORIGINAL_VERSION" != "$RELEASE_VERSION" ] && [ "$RELEASE_VERSION" != "unknown" ]; then - echo "โœ… Version changed from $ORIGINAL_VERSION to $RELEASE_VERSION" - VERSION_CHANGED="true" - else - echo "โ„น๏ธ Version unchanged: $RELEASE_VERSION" - fi - - RELEASE_TAG="${RELEASE_VERSION}" - RELEASE_TITLE="Wails ${RELEASE_VERSION}" - - # Set outputs for next steps - echo "version=$RELEASE_VERSION" >> $GITHUB_OUTPUT - echo "tag=$RELEASE_TAG" >> $GITHUB_OUTPUT - echo "title=$RELEASE_TITLE" >> $GITHUB_OUTPUT - echo "is_prerelease=true" >> $GITHUB_OUTPUT - echo "is_latest=false" >> $GITHUB_OUTPUT - echo "has_changes=${{ steps.changelog_check.outputs.has_unreleased_content }}" >> $GITHUB_OUTPUT - echo "success=$RELEASE_SUCCESS" >> $GITHUB_OUTPUT - echo "version_changed=$VERSION_CHANGED" >> $GITHUB_OUTPUT - - # Copy pre-extracted release notes - if [ "$RELEASE_SUCCESS" == "true" ]; then - echo "๐Ÿ“ Using pre-extracted release notes..." - - # Use the release_notes.md file created earlier - if [ -f "release_notes.md" ]; then - cp release_notes.md release-notes.txt - echo "โœ… Successfully copied release notes" - echo "release_notes_file=release-notes.txt" >> $GITHUB_OUTPUT - else - echo "โ„น๏ธ No pre-extracted release notes found" - echo "No detailed changelog available for this release." > release-notes.txt - echo "release_notes_file=release-notes.txt" >> $GITHUB_OUTPUT - fi - else - echo "release_notes_file=" >> $GITHUB_OUTPUT - echo "โš ๏ธ Skipping release notes generation due to release task failure" - fi - - # Set error output for later steps - if [ -n "$RELEASE_ERRORS" ]; then - echo "release_errors<> $GITHUB_OUTPUT - echo -e "$RELEASE_ERRORS" >> $GITHUB_OUTPUT - echo "EOF" >> $GITHUB_OUTPUT - echo "has_release_errors=true" >> $GITHUB_OUTPUT - else - echo "has_release_errors=false" >> $GITHUB_OUTPUT - fi - - - name: Create and push git tag - id: git_tag - if: | - (steps.quick_check.outputs.should_continue == 'true' || github.event.inputs.force_release == 'true') && - steps.check_tag.outputs.has_tag == 'false' && - github.event.inputs.dry_run != 'true' && - steps.release.outputs.success == 'true' && - steps.release.outputs.version_changed == 'true' - env: - GITHUB_TOKEN: ${{ secrets.WAILS_REPO_TOKEN || github.token }} - run: | - echo "๐Ÿท๏ธ Creating and pushing git tag: ${{ steps.release.outputs.tag }}" - - # Initialize error tracking - GIT_ERRORS="" - GIT_SUCCESS=true - - # Create git tag with error handling - if git tag -a "${{ steps.release.outputs.tag }}" -m "Release ${{ steps.release.outputs.version }}" 2>&1; then - echo "โœ… Successfully created git tag: ${{ steps.release.outputs.tag }}" - else - echo "โŒ Failed to create git tag" - GIT_ERRORS="$GIT_ERRORS\n- Failed to create git tag: ${{ steps.release.outputs.tag }}" - GIT_SUCCESS=false - fi - - # Push tag with retry logic and error handling - if [ "$GIT_SUCCESS" == "true" ]; then - RETRY_COUNT=0 - MAX_RETRIES=3 - PUSH_SUCCESS=false - - while [ $RETRY_COUNT -lt $MAX_RETRIES ] && [ "$PUSH_SUCCESS" == "false" ]; do - RETRY_COUNT=$((RETRY_COUNT + 1)) - echo "๐Ÿ”„ Attempting to push tag (attempt $RETRY_COUNT/$MAX_RETRIES)..." - - if git push "https://x-access-token:${GITHUB_TOKEN}@github.com/${{ github.repository }}.git" "${{ steps.release.outputs.tag }}" 2>&1; then - echo "โœ… Successfully pushed git tag to origin" - PUSH_SUCCESS=true - else - echo "โŒ Failed to push git tag (attempt $RETRY_COUNT/$MAX_RETRIES)" - if [ $RETRY_COUNT -lt $MAX_RETRIES ]; then - echo "โณ Waiting 5 seconds before retry..." - sleep 5 + COMMIT_COUNT=$(git rev-list ${LATEST_TAG}..HEAD --count) + if [ "$COMMIT_COUNT" -gt 0 ]; then + echo "Found $COMMIT_COUNT commits since $LATEST_TAG" + echo "has_changes=true" >> $GITHUB_OUTPUT + echo "should_continue=true" >> $GITHUB_OUTPUT + else + echo "has_changes=false" >> $GITHUB_OUTPUT + echo "should_continue=false" >> $GITHUB_OUTPUT + echo "reason=No changes since latest release $LATEST_TAG and no unreleased changelog content" >> $GITHUB_OUTPUT fi fi - done + fi + + - name: Early exit - No changes detected + if: | + steps.quick_check.outputs.should_continue == 'false' && + github.event.inputs.force_release != 'true' + run: | + echo "๐Ÿ›‘ EARLY EXIT: ${{ steps.quick_check.outputs.reason }}" + echo "" + echo "โ„น๏ธ No changes detected since last release and force_release is not enabled." + echo " Workflow will exit early to save resources." + echo "" + echo " To force a release anyway, run this workflow with 'force_release=true'" + echo "" + echo "## ๐Ÿ›‘ Early Exit Summary" >> $GITHUB_STEP_SUMMARY + echo "**Reason:** ${{ steps.quick_check.outputs.reason }}" >> $GITHUB_STEP_SUMMARY + echo "**Action:** Workflow exited early to save resources" >> $GITHUB_STEP_SUMMARY + echo "**Force Release:** Set 'force_release=true' to override this behavior" >> $GITHUB_STEP_SUMMARY + exit 0 + + - name: Continue with release process + if: | + steps.quick_check.outputs.should_continue == 'true' || + github.event.inputs.force_release == 'true' + run: | + echo "โœ… Proceeding with release process..." + if [ "${{ github.event.inputs.force_release }}" == "true" ]; then + echo "๐Ÿ”จ FORCE RELEASE: Overriding change detection" + fi + + - name: Extract changelog content before release + id: extract_changelog + if: | + steps.quick_check.outputs.should_continue == 'true' || + github.event.inputs.force_release == 'true' + run: | + cd v3 - if [ "$PUSH_SUCCESS" == "false" ]; then - echo "โŒ Failed to push git tag after $MAX_RETRIES attempts" - GIT_ERRORS="$GIT_ERRORS\n- Failed to push git tag after $MAX_RETRIES attempts" + echo "๐Ÿ“ Extracting changelog content before release..." + + # Use the new --create-release-notes flag + cd tasks/release + if go run release.go --create-release-notes ../../release_notes.md; then + echo "โœ… Successfully created release notes" + echo "has_content=true" >> $GITHUB_OUTPUT + + # Show content preview + echo "Release notes preview:" + head -10 ../../release_notes.md + else + echo "โš ๏ธ Failed to create release notes or no content found" + echo "No changelog updates in this release." > ../../release_notes.md + echo "has_content=false" >> $GITHUB_OUTPUT + fi + cd ../.. + + - name: Run release script + id: release + if: | + steps.quick_check.outputs.should_continue == 'true' || + github.event.inputs.force_release == 'true' + run: | + cd v3 + + echo "๐Ÿš€ Running release task..." + echo "=======================================================" + + # Initialize error tracking + RELEASE_ERRORS="" + RELEASE_SUCCESS=true + + # Store the original version for comparison + ORIGINAL_VERSION=$(cat internal/version/version.txt 2>/dev/null || echo "unknown") + echo "๐Ÿ“Œ Current version: $ORIGINAL_VERSION" + + # Run the release task and capture output with error handling + if [ "${{ github.event.inputs.dry_run }}" == "true" ]; then + echo "๐Ÿงช DRY RUN MODE: Simulating release task execution" + # In dry run, we'll simulate the task without making actual changes + OUTPUT=$(task release 2>&1 || true) + RELEASE_EXIT_CODE=0 # Always succeed in dry run + echo "$OUTPUT" + else + echo "๐Ÿš€ LIVE MODE: Executing release task" + OUTPUT=$(task release 2>&1) + RELEASE_EXIT_CODE=$? + echo "$OUTPUT" + + if [ $RELEASE_EXIT_CODE -ne 0 ]; then + echo "โŒ Release task failed with exit code $RELEASE_EXIT_CODE" + RELEASE_ERRORS="$RELEASE_ERRORS\n- Release task execution failed: $OUTPUT" + RELEASE_SUCCESS=false + else + echo "โœ… Release task completed successfully" + fi + fi + + # Verify version file exists and is readable + if [ ! -f "internal/version/version.txt" ]; then + echo "โŒ Version file not found: internal/version/version.txt" + RELEASE_ERRORS="$RELEASE_ERRORS\n- Version file not found after release task execution" + RELEASE_SUCCESS=false + RELEASE_VERSION="unknown" + else + RELEASE_VERSION=$(cat internal/version/version.txt 2>/dev/null || echo "unknown") + if [ "$RELEASE_VERSION" == "unknown" ]; then + echo "โŒ Failed to read version from file" + RELEASE_ERRORS="$RELEASE_ERRORS\n- Failed to read version from version.txt" + RELEASE_SUCCESS=false + else + echo "โœ… Successfully read version: $RELEASE_VERSION" + fi + fi + + # Check if version changed + VERSION_CHANGED="false" + if [ "$ORIGINAL_VERSION" != "$RELEASE_VERSION" ] && [ "$RELEASE_VERSION" != "unknown" ]; then + echo "โœ… Version changed from $ORIGINAL_VERSION to $RELEASE_VERSION" + VERSION_CHANGED="true" + else + echo "โ„น๏ธ Version unchanged: $RELEASE_VERSION" + fi + + RELEASE_TAG="${RELEASE_VERSION}" + RELEASE_TITLE="Wails ${RELEASE_VERSION}" + + # Set outputs for next steps + echo "version=$RELEASE_VERSION" >> $GITHUB_OUTPUT + echo "tag=$RELEASE_TAG" >> $GITHUB_OUTPUT + echo "title=$RELEASE_TITLE" >> $GITHUB_OUTPUT + echo "is_prerelease=true" >> $GITHUB_OUTPUT + echo "is_latest=false" >> $GITHUB_OUTPUT + echo "has_changes=${{ steps.changelog_check.outputs.has_unreleased_content }}" >> $GITHUB_OUTPUT + echo "success=$RELEASE_SUCCESS" >> $GITHUB_OUTPUT + echo "version_changed=$VERSION_CHANGED" >> $GITHUB_OUTPUT + + # Copy pre-extracted release notes + if [ "$RELEASE_SUCCESS" == "true" ]; then + echo "๐Ÿ“ Using pre-extracted release notes..." + + # Use the release_notes.md file created earlier + if [ -f "release_notes.md" ]; then + cp release_notes.md release-notes.txt + echo "โœ… Successfully copied release notes" + echo "release_notes_file=release-notes.txt" >> $GITHUB_OUTPUT + else + echo "โ„น๏ธ No pre-extracted release notes found" + echo "No detailed changelog available for this release." > release-notes.txt + echo "release_notes_file=release-notes.txt" >> $GITHUB_OUTPUT + fi + else + echo "release_notes_file=" >> $GITHUB_OUTPUT + echo "โš ๏ธ Skipping release notes generation due to release task failure" + fi + + # Set error output for later steps + if [ -n "$RELEASE_ERRORS" ]; then + echo "release_errors<> $GITHUB_OUTPUT + echo -e "$RELEASE_ERRORS" >> $GITHUB_OUTPUT + echo "EOF" >> $GITHUB_OUTPUT + echo "has_release_errors=true" >> $GITHUB_OUTPUT + else + echo "has_release_errors=false" >> $GITHUB_OUTPUT + fi + + - name: Create and push git tag + id: git_tag + if: | + (steps.quick_check.outputs.should_continue == 'true' || github.event.inputs.force_release == 'true') && + steps.check_tag.outputs.has_tag == 'false' && + github.event.inputs.dry_run != 'true' && + steps.release.outputs.success == 'true' && + steps.release.outputs.version_changed == 'true' + env: + GITHUB_TOKEN: ${{ secrets.WAILS_REPO_TOKEN || github.token }} + run: | + echo "๐Ÿท๏ธ Creating and pushing git tag: ${{ steps.release.outputs.tag }}" + + # Initialize error tracking + GIT_ERRORS="" + GIT_SUCCESS=true + + # Create git tag with error handling + if git tag -a "${{ steps.release.outputs.tag }}" -m "Release ${{ steps.release.outputs.version }}" 2>&1; then + echo "โœ… Successfully created git tag: ${{ steps.release.outputs.tag }}" + else + echo "โŒ Failed to create git tag" + GIT_ERRORS="$GIT_ERRORS\n- Failed to create git tag: ${{ steps.release.outputs.tag }}" GIT_SUCCESS=false fi - fi - - # Set outputs for later steps - echo "success=$GIT_SUCCESS" >> $GITHUB_OUTPUT - - if [ -n "$GIT_ERRORS" ]; then - echo "git_tag_errors<> $GITHUB_OUTPUT - echo -e "$GIT_ERRORS" >> $GITHUB_OUTPUT - echo "EOF" >> $GITHUB_OUTPUT - echo "has_git_errors=true" >> $GITHUB_OUTPUT - else - echo "has_git_errors=false" >> $GITHUB_OUTPUT - fi - - - name: Commit and push changes - id: git_commit - if: | - (steps.quick_check.outputs.should_continue == 'true' || github.event.inputs.force_release == 'true') && - github.event.inputs.dry_run != 'true' && - steps.release.outputs.success == 'true' && - steps.release.outputs.version_changed == 'true' - env: - GITHUB_TOKEN: ${{ secrets.WAILS_REPO_TOKEN || github.token }} - run: | - echo "๐Ÿ“ Committing and pushing changes..." - - # Initialize error tracking - COMMIT_ERRORS="" - COMMIT_SUCCESS=true - - # Add any changes made by the release script with error handling - if git add . 2>&1; then - echo "โœ… Successfully staged changes" - else - echo "โŒ Failed to stage changes" - COMMIT_ERRORS="$COMMIT_ERRORS\n- Failed to stage changes with git add" - COMMIT_SUCCESS=false - fi - - # Check if there are changes to commit - if [ "$COMMIT_SUCCESS" == "true" ]; then - if ! git diff --cached --quiet; then - echo "๐Ÿ“ Changes detected, creating commit..." - - # Create commit with error handling - if git commit -m "${{ steps.release.outputs.version }}" 2>&1; then - echo "โœ… Successfully created commit" - - # Push changes with retry logic - RETRY_COUNT=0 - MAX_RETRIES=3 - PUSH_SUCCESS=false - - while [ $RETRY_COUNT -lt $MAX_RETRIES ] && [ "$PUSH_SUCCESS" == "false" ]; do - RETRY_COUNT=$((RETRY_COUNT + 1)) - echo "๐Ÿ”„ Attempting to push changes (attempt $RETRY_COUNT/$MAX_RETRIES)..." - - if git push "https://x-access-token:${GITHUB_TOKEN}@github.com/${{ github.repository }}.git" v3-alpha 2>&1; then - echo "โœ… Successfully pushed changes to v3-alpha branch" - PUSH_SUCCESS=true - else - echo "โŒ Failed to push changes (attempt $RETRY_COUNT/$MAX_RETRIES)" - if [ $RETRY_COUNT -lt $MAX_RETRIES ]; then - echo "โณ Waiting 5 seconds before retry..." - sleep 5 - fi + + # Push tag with retry logic and error handling + if [ "$GIT_SUCCESS" == "true" ]; then + RETRY_COUNT=0 + MAX_RETRIES=3 + PUSH_SUCCESS=false + + while [ $RETRY_COUNT -lt $MAX_RETRIES ] && [ "$PUSH_SUCCESS" == "false" ]; do + RETRY_COUNT=$((RETRY_COUNT + 1)) + echo "๐Ÿ”„ Attempting to push tag (attempt $RETRY_COUNT/$MAX_RETRIES)..." + + if git push "https://x-access-token:${GITHUB_TOKEN}@github.com/${{ github.repository }}.git" "${{ steps.release.outputs.tag }}" 2>&1; then + echo "โœ… Successfully pushed git tag to origin" + PUSH_SUCCESS=true + else + echo "โŒ Failed to push git tag (attempt $RETRY_COUNT/$MAX_RETRIES)" + if [ $RETRY_COUNT -lt $MAX_RETRIES ]; then + echo "โณ Waiting 5 seconds before retry..." + sleep 5 fi - done - - if [ "$PUSH_SUCCESS" == "false" ]; then - echo "โŒ Failed to push changes after $MAX_RETRIES attempts" - COMMIT_ERRORS="$COMMIT_ERRORS\n- Failed to push changes after $MAX_RETRIES attempts" + fi + done + + if [ "$PUSH_SUCCESS" == "false" ]; then + echo "โŒ Failed to push git tag after $MAX_RETRIES attempts" + GIT_ERRORS="$GIT_ERRORS\n- Failed to push git tag after $MAX_RETRIES attempts" + GIT_SUCCESS=false + fi + fi + + # Set outputs for later steps + echo "success=$GIT_SUCCESS" >> $GITHUB_OUTPUT + + if [ -n "$GIT_ERRORS" ]; then + echo "git_tag_errors<> $GITHUB_OUTPUT + echo -e "$GIT_ERRORS" >> $GITHUB_OUTPUT + echo "EOF" >> $GITHUB_OUTPUT + echo "has_git_errors=true" >> $GITHUB_OUTPUT + else + echo "has_git_errors=false" >> $GITHUB_OUTPUT + fi + + - name: Commit and push changes + id: git_commit + if: | + (steps.quick_check.outputs.should_continue == 'true' || github.event.inputs.force_release == 'true') && + github.event.inputs.dry_run != 'true' && + steps.release.outputs.success == 'true' && + steps.release.outputs.version_changed == 'true' + env: + GITHUB_TOKEN: ${{ secrets.WAILS_REPO_TOKEN || github.token }} + run: | + echo "๐Ÿ“ Committing and pushing changes..." + + # Initialize error tracking + COMMIT_ERRORS="" + COMMIT_SUCCESS=true + + # Add any changes made by the release script with error handling + if git add . 2>&1; then + echo "โœ… Successfully staged changes" + else + echo "โŒ Failed to stage changes" + COMMIT_ERRORS="$COMMIT_ERRORS\n- Failed to stage changes with git add" + COMMIT_SUCCESS=false + fi + + # Check if there are changes to commit + if [ "$COMMIT_SUCCESS" == "true" ]; then + if ! git diff --cached --quiet; then + echo "๐Ÿ“ Changes detected, creating commit..." + + # Create commit with error handling + if git commit -m "${{ steps.release.outputs.version }}" 2>&1; then + echo "โœ… Successfully created commit" + + # Push changes with retry logic + RETRY_COUNT=0 + MAX_RETRIES=3 + PUSH_SUCCESS=false + + while [ $RETRY_COUNT -lt $MAX_RETRIES ] && [ "$PUSH_SUCCESS" == "false" ]; do + RETRY_COUNT=$((RETRY_COUNT + 1)) + echo "๐Ÿ”„ Attempting to push changes (attempt $RETRY_COUNT/$MAX_RETRIES)..." + + if git push "https://x-access-token:${GITHUB_TOKEN}@github.com/${{ github.repository }}.git" v3-alpha 2>&1; then + echo "โœ… Successfully pushed changes to v3-alpha branch" + PUSH_SUCCESS=true + else + echo "โŒ Failed to push changes (attempt $RETRY_COUNT/$MAX_RETRIES)" + if [ $RETRY_COUNT -lt $MAX_RETRIES ]; then + echo "โณ Waiting 5 seconds before retry..." + sleep 5 + fi + fi + done + + if [ "$PUSH_SUCCESS" == "false" ]; then + echo "โŒ Failed to push changes after $MAX_RETRIES attempts" + COMMIT_ERRORS="$COMMIT_ERRORS\n- Failed to push changes after $MAX_RETRIES attempts" + COMMIT_SUCCESS=false + fi + else + echo "โŒ Failed to create commit" + COMMIT_ERRORS="$COMMIT_ERRORS\n- Failed to create git commit" COMMIT_SUCCESS=false fi else - echo "โŒ Failed to create commit" - COMMIT_ERRORS="$COMMIT_ERRORS\n- Failed to create git commit" - COMMIT_SUCCESS=false + echo "โ„น๏ธ No changes to commit" + fi + fi + + # Set outputs for later steps + echo "success=$COMMIT_SUCCESS" >> $GITHUB_OUTPUT + + if [ -n "$COMMIT_ERRORS" ]; then + echo "commit_errors<> $GITHUB_OUTPUT + echo -e "$COMMIT_ERRORS" >> $GITHUB_OUTPUT + echo "EOF" >> $GITHUB_OUTPUT + echo "has_commit_errors=true" >> $GITHUB_OUTPUT + else + echo "has_commit_errors=false" >> $GITHUB_OUTPUT + fi + + - name: Read release notes + id: read_notes + if: | + (steps.quick_check.outputs.should_continue == 'true' || github.event.inputs.force_release == 'true') && + steps.release.outputs.release_notes_file != '' && + steps.release.outputs.version_changed == 'true' + run: | + cd v3 + if [ -f "release-notes.txt" ]; then + # Read the release notes and add header + echo "### Changes in this release:" > formatted-release-notes.txt + echo "" >> formatted-release-notes.txt + cat release-notes.txt >> formatted-release-notes.txt + + # Read the formatted notes for output + RELEASE_NOTES=$(cat formatted-release-notes.txt) + echo "release_notes<> $GITHUB_OUTPUT + echo "$RELEASE_NOTES" >> $GITHUB_OUTPUT + echo "EOF" >> $GITHUB_OUTPUT + else + echo "release_notes=No release notes available" >> $GITHUB_OUTPUT + fi + + - name: Test GitHub Release Creation (DRY RUN) + if: | + (steps.quick_check.outputs.should_continue == 'true' || github.event.inputs.force_release == 'true') && + github.event.inputs.dry_run == 'true' && + steps.release.outputs.version_changed == 'true' + run: | + echo "๐Ÿงช DRY RUN: Would create GitHub release with the following parameters:" + echo "=======================================================================" + echo "Tag Name: ${{ steps.release.outputs.tag }}" + echo "Release Name: ${{ steps.release.outputs.title }}" + echo "Is Prerelease: ${{ steps.release.outputs.is_prerelease }}" + echo "Is Latest: ${{ steps.release.outputs.is_latest }}" + echo "Has Changes: ${{ steps.release.outputs.has_changes }}" + echo "" + echo "Release Body Preview:" + echo "## Wails v3 Alpha Release - ${{ steps.release.outputs.version }}" + echo "" + cat << 'RELEASE_NOTES_EOF' + ${{ steps.read_notes.outputs.release_notes }} + RELEASE_NOTES_EOF + echo "" + echo "" + echo "" + echo "---" + echo "" + echo "๐Ÿค– This is an automated nightly release generated from the latest changes in the v3-alpha branch." + echo "" + echo "**Installation:**" + echo "\`\`\`bash" + echo "go install github.com/wailsapp/wails/v3/cmd/wails@${{ steps.release.outputs.tag }}" + echo "\`\`\`" + echo "" + echo "**โš ๏ธ Alpha Warning:** This is pre-release software and may contain bugs or incomplete features." + echo "" + echo "โœ… DRY RUN: GitHub release creation test completed successfully!" + + - name: Create GitHub Release (LIVE) + id: github_release + if: | + (steps.quick_check.outputs.should_continue == 'true' || github.event.inputs.force_release == 'true') && + github.event.inputs.dry_run != 'true' && + steps.release.outputs.success == 'true' && + steps.release.outputs.version_changed == 'true' + continue-on-error: true + run: | + echo "๐Ÿš€ Creating GitHub release using gh CLI..." + + # Create release notes in a temporary file + cat > release_notes.md << 'EOF' + ## Wails v3 Alpha Release - ${{ steps.release.outputs.version }} + + ${{ steps.read_notes.outputs.release_notes }} + + + + --- + + ๐Ÿค– This is an automated nightly release generated from the latest changes in the v3-alpha branch. + + **Installation:** + ```bash + go install github.com/wailsapp/wails/v3/cmd/wails@${{ steps.release.outputs.tag }} + ``` + + **โš ๏ธ Alpha Warning:** This is pre-release software and may contain bugs or incomplete features. + EOF + + # Create the release + if gh release create "${{ steps.release.outputs.tag }}" \ + --title "${{ steps.release.outputs.title }}" \ + --notes-file release_notes.md \ + --target v3-alpha \ + --prerelease; then + echo "โœ… Successfully created GitHub release" + echo "outcome=success" >> $GITHUB_OUTPUT + else + echo "โŒ Failed to create GitHub release" + echo "outcome=failure" >> $GITHUB_OUTPUT + fi + env: + GITHUB_TOKEN: ${{ secrets.WAILS_REPO_TOKEN || github.token }} + + - name: Handle GitHub Release Creation Result + id: release_result + if: | + (steps.quick_check.outputs.should_continue == 'true' || github.event.inputs.force_release == 'true') && + github.event.inputs.dry_run != 'true' && + steps.release.outputs.success == 'true' && + steps.release.outputs.version_changed == 'true' + run: | + echo "๐Ÿ“‹ Checking GitHub release creation result..." + + # Initialize error tracking + GITHUB_ERRORS="" + GITHUB_SUCCESS=true + + # Check if GitHub release creation succeeded + if [ "${{ steps.github_release.outcome }}" == "success" ]; then + echo "โœ… GitHub release created successfully" + echo "๐Ÿ”— Release URL: https://github.com/${{ github.repository }}/releases/tag/${{ steps.release.outputs.tag }}" + else + echo "โŒ GitHub release creation failed" + GITHUB_ERRORS="$GITHUB_ERRORS\n- GitHub release creation failed with outcome: ${{ steps.github_release.outcome }}" + GITHUB_SUCCESS=false + fi + + # Set outputs for summary + echo "success=$GITHUB_SUCCESS" >> $GITHUB_OUTPUT + + if [ -n "$GITHUB_ERRORS" ]; then + echo "github_errors<> $GITHUB_OUTPUT + echo -e "$GITHUB_ERRORS" >> $GITHUB_OUTPUT + echo "EOF" >> $GITHUB_OUTPUT + echo "has_github_errors=true" >> $GITHUB_OUTPUT + else + echo "has_github_errors=false" >> $GITHUB_OUTPUT + fi + + - name: Error Summary and Reporting + id: error_summary + if: always() + run: | + echo "๐Ÿ“Š Generating comprehensive error summary..." + + # Initialize error tracking + TOTAL_ERRORS=0 + ERROR_SUMMARY="" + OVERALL_SUCCESS=true + + # Check for changelog errors + if [ "${{ steps.changelog_check.outputs.has_errors }}" == "true" ]; then + echo "โŒ Changelog processing errors detected" + ERROR_SUMMARY="$ERROR_SUMMARY\n### ๐Ÿ“„ Changelog Processing Errors\n${{ steps.changelog_check.outputs.changelog_errors }}\n" + TOTAL_ERRORS=$((TOTAL_ERRORS + 1)) + OVERALL_SUCCESS=false + fi + + # Check for release script errors + if [ "${{ steps.release.outputs.has_release_errors }}" == "true" ]; then + echo "โŒ Release script errors detected" + ERROR_SUMMARY="$ERROR_SUMMARY\n### ๐Ÿš€ Release Script Errors\n${{ steps.release.outputs.release_errors }}\n" + TOTAL_ERRORS=$((TOTAL_ERRORS + 1)) + OVERALL_SUCCESS=false + fi + + # Check for git tag errors + if [ "${{ steps.git_tag.outputs.has_git_errors }}" == "true" ]; then + echo "โŒ Git tag errors detected" + ERROR_SUMMARY="$ERROR_SUMMARY\n### ๐Ÿท๏ธ Git Tag Errors\n${{ steps.git_tag.outputs.git_tag_errors }}\n" + TOTAL_ERRORS=$((TOTAL_ERRORS + 1)) + OVERALL_SUCCESS=false + fi + + # Check for git commit errors + if [ "${{ steps.git_commit.outputs.has_commit_errors }}" == "true" ]; then + echo "โŒ Git commit errors detected" + ERROR_SUMMARY="$ERROR_SUMMARY\n### ๐Ÿ“ Git Commit Errors\n${{ steps.git_commit.outputs.commit_errors }}\n" + TOTAL_ERRORS=$((TOTAL_ERRORS + 1)) + OVERALL_SUCCESS=false + fi + + # Check for GitHub release errors + if [ "${{ steps.release_result.outputs.has_github_errors }}" == "true" ]; then + echo "โŒ GitHub release errors detected" + ERROR_SUMMARY="$ERROR_SUMMARY\n### ๐Ÿ™ GitHub Release Errors\n${{ steps.release_result.outputs.github_errors }}\n" + TOTAL_ERRORS=$((TOTAL_ERRORS + 1)) + OVERALL_SUCCESS=false + fi + + # Set outputs for final summary + echo "total_errors=$TOTAL_ERRORS" >> $GITHUB_OUTPUT + echo "overall_success=$OVERALL_SUCCESS" >> $GITHUB_OUTPUT + + if [ -n "$ERROR_SUMMARY" ]; then + echo "error_summary<> $GITHUB_OUTPUT + echo -e "$ERROR_SUMMARY" >> $GITHUB_OUTPUT + echo "EOF" >> $GITHUB_OUTPUT + fi + + # Log summary + if [ "$OVERALL_SUCCESS" == "true" ]; then + echo "โœ… Workflow completed successfully with no errors" + else + echo "โš ๏ธ Workflow completed with $TOTAL_ERRORS error categories" + fi + + - name: Summary + if: always() + run: | + if [ "${{ github.event.inputs.dry_run }}" == "true" ]; then + echo "## ๐Ÿงช DRY RUN Release Test Summary" >> $GITHUB_STEP_SUMMARY + else + echo "## ๐Ÿš€ Nightly Release Summary" >> $GITHUB_STEP_SUMMARY + fi + echo "================================" >> $GITHUB_STEP_SUMMARY + echo "- **Version:** ${{ steps.release.outputs.version }}" >> $GITHUB_STEP_SUMMARY + echo "- **Tag:** ${{ steps.release.outputs.tag }}" >> $GITHUB_STEP_SUMMARY + echo "- **Version Changed:** ${{ steps.release.outputs.version_changed }}" >> $GITHUB_STEP_SUMMARY + echo "- **Has existing tag:** ${{ steps.check_tag.outputs.has_tag }}" >> $GITHUB_STEP_SUMMARY + echo "- **Has unreleased changelog content:** ${{ steps.changelog_check.outputs.has_unreleased_content }}" >> $GITHUB_STEP_SUMMARY + echo "- **Has changes:** ${{ steps.release.outputs.has_changes }}" >> $GITHUB_STEP_SUMMARY + echo "- **Is prerelease:** ${{ steps.release.outputs.is_prerelease }}" >> $GITHUB_STEP_SUMMARY + echo "- **Is latest:** ${{ steps.release.outputs.is_latest }}" >> $GITHUB_STEP_SUMMARY + echo "" >> $GITHUB_STEP_SUMMARY + + # Overall status + if [ "${{ steps.error_summary.outputs.overall_success }}" == "true" ]; then + if [ "${{ github.event.inputs.dry_run }}" == "true" ]; then + echo "- **Mode:** ๐Ÿงช DRY RUN (no actual release created)" >> $GITHUB_STEP_SUMMARY + echo "- **Status:** โœ… Test completed successfully" >> $GITHUB_STEP_SUMMARY + else + echo "- **Mode:** ๐Ÿš€ Live release" >> $GITHUB_STEP_SUMMARY + echo "- **Status:** โœ… Release created successfully" >> $GITHUB_STEP_SUMMARY fi else - echo "โ„น๏ธ No changes to commit" + echo "- **Mode:** ${{ github.event.inputs.dry_run == 'true' && '๐Ÿงช DRY RUN' || '๐Ÿš€ Live release' }}" >> $GITHUB_STEP_SUMMARY + echo "- **Status:** โš ๏ธ Completed with ${{ steps.error_summary.outputs.total_errors }} error(s)" >> $GITHUB_STEP_SUMMARY fi - fi - - # Set outputs for later steps - echo "success=$COMMIT_SUCCESS" >> $GITHUB_OUTPUT - - if [ -n "$COMMIT_ERRORS" ]; then - echo "commit_errors<> $GITHUB_OUTPUT - echo -e "$COMMIT_ERRORS" >> $GITHUB_OUTPUT - echo "EOF" >> $GITHUB_OUTPUT - echo "has_commit_errors=true" >> $GITHUB_OUTPUT - else - echo "has_commit_errors=false" >> $GITHUB_OUTPUT - fi - - - name: Read release notes - id: read_notes - if: | - (steps.quick_check.outputs.should_continue == 'true' || github.event.inputs.force_release == 'true') && - steps.release.outputs.release_notes_file != '' && - steps.release.outputs.version_changed == 'true' - run: | - cd v3 - if [ -f "release-notes.txt" ]; then - # Read the release notes and add header - echo "### Changes in this release:" > formatted-release-notes.txt - echo "" >> formatted-release-notes.txt - cat release-notes.txt >> formatted-release-notes.txt - # Read the formatted notes for output - RELEASE_NOTES=$(cat formatted-release-notes.txt) - echo "release_notes<> $GITHUB_OUTPUT - echo "$RELEASE_NOTES" >> $GITHUB_OUTPUT - echo "EOF" >> $GITHUB_OUTPUT - else - echo "release_notes=No release notes available" >> $GITHUB_OUTPUT - fi - - - name: Test GitHub Release Creation (DRY RUN) - if: | - (steps.quick_check.outputs.should_continue == 'true' || github.event.inputs.force_release == 'true') && - github.event.inputs.dry_run == 'true' && - steps.release.outputs.version_changed == 'true' - run: | - echo "๐Ÿงช DRY RUN: Would create GitHub release with the following parameters:" - echo "=======================================================================" - echo "Tag Name: ${{ steps.release.outputs.tag }}" - echo "Release Name: ${{ steps.release.outputs.title }}" - echo "Is Prerelease: ${{ steps.release.outputs.is_prerelease }}" - echo "Is Latest: ${{ steps.release.outputs.is_latest }}" - echo "Has Changes: ${{ steps.release.outputs.has_changes }}" - echo "" - echo "Release Body Preview:" - echo "## Wails v3 Alpha Release - ${{ steps.release.outputs.version }}" - echo "" - cat << 'RELEASE_NOTES_EOF' - ${{ steps.read_notes.outputs.release_notes }} - RELEASE_NOTES_EOF - echo "" - echo "" - echo "" - echo "---" - echo "" - echo "๐Ÿค– This is an automated nightly release generated from the latest changes in the v3-alpha branch." - echo "" - echo "**Installation:**" - echo "\`\`\`bash" - echo "go install github.com/wailsapp/wails/v3/cmd/wails@${{ steps.release.outputs.tag }}" - echo "\`\`\`" - echo "" - echo "**โš ๏ธ Alpha Warning:** This is pre-release software and may contain bugs or incomplete features." - echo "" - echo "โœ… DRY RUN: GitHub release creation test completed successfully!" - - - name: Create GitHub Release (LIVE) - id: github_release - if: | - (steps.quick_check.outputs.should_continue == 'true' || github.event.inputs.force_release == 'true') && - github.event.inputs.dry_run != 'true' && - steps.release.outputs.success == 'true' && - steps.release.outputs.version_changed == 'true' - continue-on-error: true - run: | - echo "๐Ÿš€ Creating GitHub release using gh CLI..." - - # Create release notes in a temporary file - cat > release_notes.md << 'EOF' - ## Wails v3 Alpha Release - ${{ steps.release.outputs.version }} - - ${{ steps.read_notes.outputs.release_notes }} - - - - --- - - ๐Ÿค– This is an automated nightly release generated from the latest changes in the v3-alpha branch. - - **Installation:** - ```bash - go install github.com/wailsapp/wails/v3/cmd/wails@${{ steps.release.outputs.tag }} - ``` - - **โš ๏ธ Alpha Warning:** This is pre-release software and may contain bugs or incomplete features. - EOF - - # Create the release - if gh release create "${{ steps.release.outputs.tag }}" \ - --title "${{ steps.release.outputs.title }}" \ - --notes-file release_notes.md \ - --target v3-alpha \ - --prerelease; then - echo "โœ… Successfully created GitHub release" - echo "outcome=success" >> $GITHUB_OUTPUT - else - echo "โŒ Failed to create GitHub release" - echo "outcome=failure" >> $GITHUB_OUTPUT - fi - env: - GITHUB_TOKEN: ${{ secrets.WAILS_REPO_TOKEN || github.token }} - - - name: Handle GitHub Release Creation Result - id: release_result - if: | - (steps.quick_check.outputs.should_continue == 'true' || github.event.inputs.force_release == 'true') && - github.event.inputs.dry_run != 'true' && - steps.release.outputs.success == 'true' && - steps.release.outputs.version_changed == 'true' - run: | - echo "๐Ÿ“‹ Checking GitHub release creation result..." - - # Initialize error tracking - GITHUB_ERRORS="" - GITHUB_SUCCESS=true - - # Check if GitHub release creation succeeded - if [ "${{ steps.github_release.outcome }}" == "success" ]; then - echo "โœ… GitHub release created successfully" - echo "๐Ÿ”— Release URL: https://github.com/${{ github.repository }}/releases/tag/${{ steps.release.outputs.tag }}" - else - echo "โŒ GitHub release creation failed" - GITHUB_ERRORS="$GITHUB_ERRORS\n- GitHub release creation failed with outcome: ${{ steps.github_release.outcome }}" - GITHUB_SUCCESS=false - fi - - # Set outputs for summary - echo "success=$GITHUB_SUCCESS" >> $GITHUB_OUTPUT - - if [ -n "$GITHUB_ERRORS" ]; then - echo "github_errors<> $GITHUB_OUTPUT - echo -e "$GITHUB_ERRORS" >> $GITHUB_OUTPUT - echo "EOF" >> $GITHUB_OUTPUT - echo "has_github_errors=true" >> $GITHUB_OUTPUT - else - echo "has_github_errors=false" >> $GITHUB_OUTPUT - fi - - - name: Error Summary and Reporting - id: error_summary - if: always() - run: | - echo "๐Ÿ“Š Generating comprehensive error summary..." - - # Initialize error tracking - TOTAL_ERRORS=0 - ERROR_SUMMARY="" - OVERALL_SUCCESS=true - - # Check for changelog errors - if [ "${{ steps.changelog_check.outputs.has_errors }}" == "true" ]; then - echo "โŒ Changelog processing errors detected" - ERROR_SUMMARY="$ERROR_SUMMARY\n### ๐Ÿ“„ Changelog Processing Errors\n${{ steps.changelog_check.outputs.changelog_errors }}\n" - TOTAL_ERRORS=$((TOTAL_ERRORS + 1)) - OVERALL_SUCCESS=false - fi - - # Check for release script errors - if [ "${{ steps.release.outputs.has_release_errors }}" == "true" ]; then - echo "โŒ Release script errors detected" - ERROR_SUMMARY="$ERROR_SUMMARY\n### ๐Ÿš€ Release Script Errors\n${{ steps.release.outputs.release_errors }}\n" - TOTAL_ERRORS=$((TOTAL_ERRORS + 1)) - OVERALL_SUCCESS=false - fi - - # Check for git tag errors - if [ "${{ steps.git_tag.outputs.has_git_errors }}" == "true" ]; then - echo "โŒ Git tag errors detected" - ERROR_SUMMARY="$ERROR_SUMMARY\n### ๐Ÿท๏ธ Git Tag Errors\n${{ steps.git_tag.outputs.git_tag_errors }}\n" - TOTAL_ERRORS=$((TOTAL_ERRORS + 1)) - OVERALL_SUCCESS=false - fi - - # Check for git commit errors - if [ "${{ steps.git_commit.outputs.has_commit_errors }}" == "true" ]; then - echo "โŒ Git commit errors detected" - ERROR_SUMMARY="$ERROR_SUMMARY\n### ๐Ÿ“ Git Commit Errors\n${{ steps.git_commit.outputs.commit_errors }}\n" - TOTAL_ERRORS=$((TOTAL_ERRORS + 1)) - OVERALL_SUCCESS=false - fi - - # Check for GitHub release errors - if [ "${{ steps.release_result.outputs.has_github_errors }}" == "true" ]; then - echo "โŒ GitHub release errors detected" - ERROR_SUMMARY="$ERROR_SUMMARY\n### ๐Ÿ™ GitHub Release Errors\n${{ steps.release_result.outputs.github_errors }}\n" - TOTAL_ERRORS=$((TOTAL_ERRORS + 1)) - OVERALL_SUCCESS=false - fi - - # Set outputs for final summary - echo "total_errors=$TOTAL_ERRORS" >> $GITHUB_OUTPUT - echo "overall_success=$OVERALL_SUCCESS" >> $GITHUB_OUTPUT - - if [ -n "$ERROR_SUMMARY" ]; then - echo "error_summary<> $GITHUB_OUTPUT - echo -e "$ERROR_SUMMARY" >> $GITHUB_OUTPUT - echo "EOF" >> $GITHUB_OUTPUT - fi - - # Log summary - if [ "$OVERALL_SUCCESS" == "true" ]; then - echo "โœ… Workflow completed successfully with no errors" - else - echo "โš ๏ธ Workflow completed with $TOTAL_ERRORS error categories" - fi - - - name: Summary - if: always() - run: | - DRY_RUN_INPUT="${{ github.event.inputs.dry_run }}"; [ -z "$DRY_RUN_INPUT" ] && DRY_RUN_INPUT=false - if [ "$DRY_RUN_INPUT" == "true" ]; then - echo "## ๐Ÿงช DRY RUN Release Test Summary" >> $GITHUB_STEP_SUMMARY - else - echo "## ๐Ÿš€ Nightly Release Summary" >> $GITHUB_STEP_SUMMARY - fi - echo "================================" >> $GITHUB_STEP_SUMMARY - echo "- **Version:** ${{ steps.release.outputs.version }}" >> $GITHUB_STEP_SUMMARY - echo "- **Tag:** ${{ steps.release.outputs.tag }}" >> $GITHUB_STEP_SUMMARY - echo "- **Version Changed:** ${{ steps.release.outputs.version_changed }}" >> $GITHUB_STEP_SUMMARY - echo "- **Has existing tag:** ${{ steps.check_tag.outputs.has_tag }}" >> $GITHUB_STEP_SUMMARY - echo "- **Has unreleased changelog content:** ${{ steps.changelog_check.outputs.has_unreleased_content }}" >> $GITHUB_STEP_SUMMARY - echo "- **Has changes:** ${{ steps.release.outputs.has_changes }}" >> $GITHUB_STEP_SUMMARY - echo "- **Is prerelease:** ${{ steps.release.outputs.is_prerelease }}" >> $GITHUB_STEP_SUMMARY - echo "- **Is latest:** ${{ steps.release.outputs.is_latest }}" >> $GITHUB_STEP_SUMMARY - echo "" >> $GITHUB_STEP_SUMMARY - - # Overall status - if [ "${{ steps.error_summary.outputs.overall_success }}" == "true" ]; then - if [ "$DRY_RUN_INPUT" == "true" ]; then - echo "- **Mode:** ๐Ÿงช DRY RUN (no actual release created)" >> $GITHUB_STEP_SUMMARY - echo "- **Status:** โœ… Test completed successfully" >> $GITHUB_STEP_SUMMARY + echo "" >> $GITHUB_STEP_SUMMARY + echo "### Release Processing" >> $GITHUB_STEP_SUMMARY + if [ "${{ steps.release.outputs.version_changed }}" == "true" ]; then + echo "โœ… **Version was incremented** and release created" >> $GITHUB_STEP_SUMMARY else - echo "- **Mode:** ๐Ÿš€ Live release" >> $GITHUB_STEP_SUMMARY - echo "- **Status:** โœ… Release created successfully" >> $GITHUB_STEP_SUMMARY + echo "โ„น๏ธ **Version was not changed** - no release created" >> $GITHUB_STEP_SUMMARY fi - else - echo "- **Mode:** ${{ github.event.inputs.dry_run == 'true' && '๐Ÿงช DRY RUN' || '๐Ÿš€ Live release' }}" >> $GITHUB_STEP_SUMMARY - echo "- **Status:** โš ๏ธ Completed with ${{ steps.error_summary.outputs.total_errors }} error(s)" >> $GITHUB_STEP_SUMMARY - fi - - echo "" >> $GITHUB_STEP_SUMMARY - echo "### Release Processing" >> $GITHUB_STEP_SUMMARY - if [ "${{ steps.release.outputs.version_changed }}" == "true" ]; then - echo "โœ… **Version was incremented** and release created" >> $GITHUB_STEP_SUMMARY - else - echo "โ„น๏ธ **Version was not changed** - no release created" >> $GITHUB_STEP_SUMMARY - fi - - echo "" >> $GITHUB_STEP_SUMMARY - echo "### Changelog Processing" >> $GITHUB_STEP_SUMMARY - if [ "${{ steps.changelog_check.outputs.has_unreleased_content }}" == "true" ]; then - echo "โœ… **UNRELEASED_CHANGELOG.md** had content and was processed" >> $GITHUB_STEP_SUMMARY - echo "- Content moved to main changelog" >> $GITHUB_STEP_SUMMARY - echo "- UNRELEASED_CHANGELOG.md reset with template" >> $GITHUB_STEP_SUMMARY - else - echo "โ„น๏ธ **UNRELEASED_CHANGELOG.md** had no content to process" >> $GITHUB_STEP_SUMMARY - fi - - # Error reporting section - ERRORS_TOTAL="${{ steps.error_summary.outputs.total_errors }}" - ERRORS_TOTAL=${ERRORS_TOTAL:-0} - if [ "$ERRORS_TOTAL" -gt 0 ]; then + echo "" >> $GITHUB_STEP_SUMMARY - echo "## โš ๏ธ Error Report" >> $GITHUB_STEP_SUMMARY - echo "**Total Error Categories:** $ERRORS_TOTAL" >> $GITHUB_STEP_SUMMARY + echo "### Changelog Processing" >> $GITHUB_STEP_SUMMARY + if [ "${{ steps.changelog_check.outputs.has_unreleased_content }}" == "true" ]; then + echo "โœ… **UNRELEASED_CHANGELOG.md** had content and was processed" >> $GITHUB_STEP_SUMMARY + echo "- Content moved to main changelog" >> $GITHUB_STEP_SUMMARY + echo "- UNRELEASED_CHANGELOG.md reset with template" >> $GITHUB_STEP_SUMMARY + else + echo "โ„น๏ธ **UNRELEASED_CHANGELOG.md** had no content to process" >> $GITHUB_STEP_SUMMARY + fi + + # Error reporting section + if [ "${{ steps.error_summary.outputs.total_errors }}" -gt 0 ]; then + echo "" >> $GITHUB_STEP_SUMMARY + echo "## โš ๏ธ Error Report" >> $GITHUB_STEP_SUMMARY + echo "**Total Error Categories:** ${{ steps.error_summary.outputs.total_errors }}" >> $GITHUB_STEP_SUMMARY + echo "" >> $GITHUB_STEP_SUMMARY + echo "${{ steps.error_summary.outputs.error_summary }}" >> $GITHUB_STEP_SUMMARY + echo "" >> $GITHUB_STEP_SUMMARY + echo "### ๐Ÿ”ง Troubleshooting Tips" >> $GITHUB_STEP_SUMMARY + echo "- Check the individual step logs above for detailed error messages" >> $GITHUB_STEP_SUMMARY + echo "- Verify GitHub token permissions (contents: write, pull-requests: read)" >> $GITHUB_STEP_SUMMARY + echo "- Ensure UNRELEASED_CHANGELOG.md follows the expected format" >> $GITHUB_STEP_SUMMARY + echo "- Check for network connectivity issues if git/GitHub operations failed" >> $GITHUB_STEP_SUMMARY + echo "- Re-run the workflow with 'force_release=true' if needed" >> $GITHUB_STEP_SUMMARY + fi + echo "" >> $GITHUB_STEP_SUMMARY - echo "${{ steps.error_summary.outputs.error_summary }}" >> $GITHUB_STEP_SUMMARY + echo "### Release Notes Preview" >> $GITHUB_STEP_SUMMARY + if [ -n "${{ steps.read_notes.outputs.release_notes }}" ]; then + echo "${{ steps.read_notes.outputs.release_notes }}" >> $GITHUB_STEP_SUMMARY + else + echo "No specific release notes generated" >> $GITHUB_STEP_SUMMARY + fi echo "" >> $GITHUB_STEP_SUMMARY - echo "### ๐Ÿ”ง Troubleshooting Tips" >> $GITHUB_STEP_SUMMARY - echo "- Check the individual step logs above for detailed error messages" >> $GITHUB_STEP_SUMMARY - echo "- Verify GitHub token permissions (contents: write, pull-requests: read)" >> $GITHUB_STEP_SUMMARY - echo "- Ensure UNRELEASED_CHANGELOG.md follows the expected format" >> $GITHUB_STEP_SUMMARY - echo "- Check for network connectivity issues if git/GitHub operations failed" >> $GITHUB_STEP_SUMMARY - echo "- Re-run the workflow with 'force_release=true' if needed" >> $GITHUB_STEP_SUMMARY - fi - - echo "" >> $GITHUB_STEP_SUMMARY - echo "### Release Notes Preview" >> $GITHUB_STEP_SUMMARY - if [ -n "${{ steps.read_notes.outputs.release_notes }}" ]; then - echo "${{ steps.read_notes.outputs.release_notes }}" >> $GITHUB_STEP_SUMMARY - else - echo "No specific release notes generated" >> $GITHUB_STEP_SUMMARY - fi - echo "" >> $GITHUB_STEP_SUMMARY - echo "---" >> $GITHUB_STEP_SUMMARY - echo "*Generated by automated nightly release workflow with enhanced error handling and changelog integration*" >> $GITHUB_STEP_SUMMARY - - # Set final workflow status - if [ "${{ steps.error_summary.outputs.overall_success }}" != "true" ]; then - echo "โš ๏ธ Workflow completed with errors. Check the summary above for details." - exit 1 - fi + echo "---" >> $GITHUB_STEP_SUMMARY + echo "*Generated by automated nightly release workflow with enhanced error handling and changelog integration*" >> $GITHUB_STEP_SUMMARY + + # Set final workflow status + if [ "${{ steps.error_summary.outputs.overall_success }}" != "true" ]; then + echo "โš ๏ธ Workflow completed with errors. Check the summary above for details." + exit 1 + fi \ No newline at end of file