diff --git a/.github/workflows/backmerge-to-develop.yml b/.github/workflows/backmerge-to-develop.yml index 11df6d1..7983f7f 100644 --- a/.github/workflows/backmerge-to-develop.yml +++ b/.github/workflows/backmerge-to-develop.yml @@ -86,10 +86,10 @@ jobs: # Create PR using GitHub CLI PR_TITLE="chore: backmerge v${{ steps.version.outputs.version }} to develop" - cat > pr_body.md << 'PREOF' + cat > pr_body.md << EOF ## Automated Backmerge - This PR automatically backmerges changes from `main` to `develop` branch. + This PR automatically backmerges changes from \`main\` to \`develop\` branch. ### Source - **Original PR:** #${{ github.event.pull_request.number }} @@ -98,7 +98,7 @@ jobs: - **Merged at:** ${{ github.event.pull_request.merged_at }} ### Branch Information - - **Source branch:** `${{ github.event.pull_request.head.ref }}` + - **Source branch:** \`${{ github.event.pull_request.head.ref }}\` - **Type:** ${{ github.event.pull_request.head.ref }} ### Actions Required @@ -109,7 +109,7 @@ jobs: --- *This PR was automatically created by GitHub Actions workflow.* - PREOF + EOF # Create PR with review requirements # Uncomment --draft if you want PRs to be created as draft @@ -136,10 +136,10 @@ jobs: # Create PR with conflict warning PR_TITLE="chore: backmerge v${{ steps.version.outputs.version }} to develop (conflicts)" - cat > pr_conflict_body.md << 'CONFLICT_EOF' + cat > pr_conflict_body.md << EOF ## ⚠️ Automated Backmerge with Conflicts - This PR attempts to backmerge changes from `main` to `develop` branch, but **conflicts were detected**. + This PR attempts to backmerge changes from \`main\` to \`develop\` branch, but **conflicts were detected**. ### Source - **Original PR:** #${{ github.event.pull_request.number }} @@ -148,28 +148,28 @@ jobs: - **Merged at:** ${{ github.event.pull_request.merged_at }} ### Branch Information - - **Source branch:** `${{ github.event.pull_request.head.ref }}` + - **Source branch:** \`${{ github.event.pull_request.head.ref }}\` - **Type:** ${{ github.event.pull_request.head.ref }} ### ⚠️ Manual Actions Required 1. Checkout the branch locally - 2. Merge `main` and resolve conflicts manually + 2. Merge \`main\` and resolve conflicts manually 3. Push the resolved changes 4. Request review and merge this PR - ```bash + \`\`\`bash git fetch origin - git checkout -b ${BACKMERGE_BRANCH} origin/${BACKMERGE_BRANCH} + git checkout -b \${BACKMERGE_BRANCH} origin/\${BACKMERGE_BRANCH} git merge origin/main # Resolve conflicts in your editor git add . git commit - git push origin ${BACKMERGE_BRANCH} - ``` + git push origin \${BACKMERGE_BRANCH} + \`\`\` --- *This PR was automatically created by GitHub Actions workflow. Manual conflict resolution is required.* - CONFLICT_EOF + EOF gh pr create \ --base develop \ diff --git a/.github/workflows/create-release.yml b/.github/workflows/create-release.yml deleted file mode 100644 index 4d2fb6d..0000000 --- a/.github/workflows/create-release.yml +++ /dev/null @@ -1,218 +0,0 @@ -name: Create Release and Tag - -on: - pull_request: - types: [closed] - branches: - - main - -jobs: - create-release: - # Only run if PR was merged (not just closed) and came from release/* or hotfix/* branch - if: | - github.event.pull_request.merged == true && - (startsWith(github.event.pull_request.head.ref, 'release/') || - startsWith(github.event.pull_request.head.ref, 'hotfix/')) - - runs-on: ubuntu-latest - - permissions: - contents: write - pull-requests: read - - steps: - - name: Checkout repository - uses: actions/checkout@v4 - with: - fetch-depth: 0 # Need full history for changelog generation - token: ${{ secrets.GITHUB_TOKEN }} - - - name: Setup Ruby - uses: ruby/setup-ruby@v1 - with: - ruby-version: "3.2" - - - name: Configure Git - run: | - git config user.name "github-actions[bot]" - git config user.email "github-actions[bot]@users.noreply.github.com" - - - name: Extract version from branch name - id: version - run: | - BRANCH_NAME="${{ github.event.pull_request.head.ref }}" - echo "branch_name=$BRANCH_NAME" >> $GITHUB_OUTPUT - - if [[ $BRANCH_NAME == release/v* ]]; then - VERSION=$(echo $BRANCH_NAME | sed 's/release\/v//') - TYPE="release" - IS_PRERELEASE="false" - elif [[ $BRANCH_NAME == hotfix/v* ]]; then - VERSION=$(echo $BRANCH_NAME | sed 's/hotfix\/v//') - TYPE="hotfix" - IS_PRERELEASE="false" - fi - - # Validate version format - if [[ ! "$VERSION" =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]]; then - echo "❌ Invalid version format: $VERSION" - echo "Version must be in format x.y.z" - exit 1 - fi - - echo "version=$VERSION" >> $GITHUB_OUTPUT - echo "type=$TYPE" >> $GITHUB_OUTPUT - echo "tag_name=v$VERSION" >> $GITHUB_OUTPUT - echo "is_prerelease=$IS_PRERELEASE" >> $GITHUB_OUTPUT - - echo "✅ Extracted version: $VERSION ($TYPE)" - - - name: Check if tag already exists - id: check_tag - run: | - TAG_NAME="v${{ steps.version.outputs.version }}" - - if git rev-parse "$TAG_NAME" >/dev/null 2>&1; then - echo "exists=true" >> $GITHUB_OUTPUT - echo "⚠️ Tag $TAG_NAME already exists" - else - echo "exists=false" >> $GITHUB_OUTPUT - echo "✅ Tag $TAG_NAME does not exist, ready to create" - fi - - - name: Generate changelog for release - id: changelog - run: | - VERSION="${{ steps.version.outputs.version }}" - - echo "Generating changelog for version $VERSION..." - - # Generate changelog using the Ruby script - ruby scripts/generate_changelog.rb \ - --version "$VERSION" \ - --force - - if [ -f "CHANGELOG.md" ]; then - echo "✅ Changelog generated successfully" - - # Extract just the latest version section for the release notes - sed -n "/## \[v$VERSION\]/,/## \[/p" CHANGELOG.md | head -n -1 > RELEASE_CHANGELOG.md - - # Save changelog content for release body (limit to reasonable size) - echo "changelog<> $GITHUB_OUTPUT - head -c 4000 RELEASE_CHANGELOG.md >> $GITHUB_OUTPUT - echo "EOF" >> $GITHUB_OUTPUT - else - echo "❌ Failed to generate changelog" - exit 1 - fi - - - name: Create Git tag - if: steps.check_tag.outputs.exists == 'false' - run: | - TAG_NAME="${{ steps.version.outputs.tag_name }}" - VERSION="${{ steps.version.outputs.version }}" - TYPE="${{ steps.version.outputs.type }}" - - # Create annotated tag - if [ "$TYPE" = "release" ]; then - TAG_MESSAGE="Release v$VERSION" - else - TAG_MESSAGE="Hotfix v$VERSION" - fi - - git tag -a "$TAG_NAME" -m "$TAG_MESSAGE" - git push origin "$TAG_NAME" - - echo "✅ Created and pushed tag: $TAG_NAME" - - - name: Create GitHub Release - if: steps.check_tag.outputs.exists == 'false' - env: - GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} - run: | - TAG_NAME="${{ steps.version.outputs.tag_name }}" - VERSION="${{ steps.version.outputs.version }}" - TYPE="${{ steps.version.outputs.type }}" - IS_PRERELEASE="${{ steps.version.outputs.is_prerelease }}" - - # Set release title and flags - if [ "$TYPE" = "release" ]; then - RELEASE_TITLE="🚀 Release v$VERSION" - RELEASE_FLAGS="" - else - RELEASE_TITLE="🔥 Hotfix v$VERSION" - RELEASE_FLAGS="" - fi - - # Add prerelease flag if needed - if [ "$IS_PRERELEASE" = "true" ]; then - RELEASE_FLAGS="$RELEASE_FLAGS --prerelease" - fi - - # Create the GitHub release - cat > release_body.md << 'RELEASE_EOF' - ${{ steps.changelog.outputs.changelog }} - - --- - - ## 📦 Installation - - ### Docker - ```bash - docker pull ghcr.io/banua-coder/pico-api-docs:v${{ steps.version.outputs.version }} - ``` - - ### Manual Download - Download the latest build artifacts from this release. - - ## 🔗 Related Links - - - **API Documentation**: https://pico-api-docs.banuacoder.com - - **Source Code**: https://github.com/banua-coder/pico-api-docs - - **Issues**: https://github.com/banua-coder/pico-api-docs/issues - - ## 📋 Changelog - - For detailed changes, see [CHANGELOG.md](https://github.com/banua-coder/pico-api-docs/blob/main/CHANGELOG.md) - RELEASE_EOF - - # Create the release - gh release create "$TAG_NAME" \ - --title "$RELEASE_TITLE" \ - --notes-file release_body.md \ - --target main \ - $RELEASE_FLAGS - - echo "✅ GitHub release created: $TAG_NAME" - - # Get release URL for summary - RELEASE_URL=$(gh release view "$TAG_NAME" --json url -q '.url') - echo "release_url=$RELEASE_URL" >> $GITHUB_OUTPUT - - - name: Summary - if: always() - run: | - echo "## Release Creation Summary" >> $GITHUB_STEP_SUMMARY - echo "" >> $GITHUB_STEP_SUMMARY - echo "- **Source PR:** #${{ github.event.pull_request.number }}" >> $GITHUB_STEP_SUMMARY - echo "- **Source Branch:** \`${{ github.event.pull_request.head.ref }}\`" >> $GITHUB_STEP_SUMMARY - echo "- **Version:** v${{ steps.version.outputs.version }}" >> $GITHUB_STEP_SUMMARY - echo "- **Type:** ${{ steps.version.outputs.type }}" >> $GITHUB_STEP_SUMMARY - echo "- **Tag:** \`${{ steps.version.outputs.tag_name }}\`" >> $GITHUB_STEP_SUMMARY - echo "" >> $GITHUB_STEP_SUMMARY - - if [ "${{ steps.check_tag.outputs.exists }}" == "true" ]; then - echo "⚠️ **Status:** Skipped - tag already exists" >> $GITHUB_STEP_SUMMARY - else - echo "✅ **Status:** Release created successfully" >> $GITHUB_STEP_SUMMARY - if [ -n "${{ steps.create-release.outputs.release_url || '' }}" ]; then - echo "🔗 **Release URL:** ${{ steps.create-release.outputs.release_url }}" >> $GITHUB_STEP_SUMMARY - fi - fi - - echo "" >> $GITHUB_STEP_SUMMARY - echo "### Next Steps" >> $GITHUB_STEP_SUMMARY - echo "1. ✅ Tag and release created" >> $GITHUB_STEP_SUMMARY - echo "2. 🔄 Backmerge to develop will run automatically" >> $GITHUB_STEP_SUMMARY - echo "3. 🚀 Deployment pipeline will trigger automatically" >> $GITHUB_STEP_SUMMARY diff --git a/.github/workflows/release-automation.yml b/.github/workflows/release-automation.yml index de92612..bbba816 100644 --- a/.github/workflows/release-automation.yml +++ b/.github/workflows/release-automation.yml @@ -149,6 +149,22 @@ jobs: echo "✅ Tag $VERSION created and pushed successfully" + - name: Trigger deployment workflow + if: steps.check_tag.outputs.tag_exists == 'false' + env: + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} + run: | + VERSION="${{ steps.version.outputs.version }}" + + echo "🚀 Manually triggering deployment workflow for tag $VERSION..." + + # Trigger the deploy workflow by creating a repository dispatch event + # Since we can't directly trigger tag-based workflows, we'll use workflow_dispatch + # But first, let's try using the GitHub CLI to trigger it + gh workflow run deploy.yml --ref "$VERSION" || echo "⚠️ Could not trigger via workflow dispatch, deployment should trigger automatically" + + echo "✅ Deployment trigger attempted" + # STEP 2: CREATE BACK-MERGE TO DEVELOP - name: Generate unique back-merge branch name id: branch_name diff --git a/CHANGELOG.md b/CHANGELOG.md index 6401d2c..885c2c8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,17 @@ +## [v1.1.1] - 2025-09-08 + +### Fixed + +- Correct changelog script arguments in create-release workflow (4b1f559) + +### Maintenance + +- Prepare v1.1.1 hotfix (ebdc3b8) + +### Other + +- Duplicate create-release.yml workflow (2a30f06) + ## [v1.1.0] - 2025-09-08 ### Added