From 4b1f5590694c3400b3115d43804a34c1b1735121 Mon Sep 17 00:00:00 2001 From: Fajrian Aidil Pratama Date: Mon, 8 Sep 2025 23:28:49 +0700 Subject: [PATCH 1/4] fix: correct changelog script arguments in create-release workflow - Remove invalid --output flag from changelog generation - Fix invalid context access in workflow summary - Ensure deployment workflow triggers properly on tag creation --- .github/workflows/create-release.yml | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/.github/workflows/create-release.yml b/.github/workflows/create-release.yml index f25e944..287166d 100644 --- a/.github/workflows/create-release.yml +++ b/.github/workflows/create-release.yml @@ -90,11 +90,14 @@ jobs: # Generate changelog using the Ruby script ruby scripts/generate_changelog.rb \ --version "$VERSION" \ - --output "RELEASE_CHANGELOG.md" + --force - if [ -f "RELEASE_CHANGELOG.md" ]; then + 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 @@ -203,8 +206,8 @@ jobs: 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 + if [ -n "${{ steps.changelog.outputs.release_url || '' }}" ]; then + echo "🔗 **Release URL:** ${{ steps.changelog.outputs.release_url }}" >> $GITHUB_STEP_SUMMARY fi fi From 2a30f0616209cff3d1961b54fbc70fa0333e09db Mon Sep 17 00:00:00 2001 From: Fajrian Aidil Pratama Date: Mon, 8 Sep 2025 23:33:10 +0700 Subject: [PATCH 2/4] remove: duplicate create-release.yml workflow - Remove create-release.yml to prevent conflicts with release-automation.yml - Both workflows triggered on same events and created duplicate tags - release-automation.yml provides comprehensive GitFlow workflow - deploy.yml already handles GitHub release creation after deployment --- .github/workflows/create-release.yml | 218 --------------------------- 1 file changed, 218 deletions(-) delete mode 100644 .github/workflows/create-release.yml diff --git a/.github/workflows/create-release.yml b/.github/workflows/create-release.yml deleted file mode 100644 index 287166d..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.changelog.outputs.release_url || '' }}" ]; then - echo "🔗 **Release URL:** ${{ steps.changelog.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 From ebdc3b8d3ace6592d91ae4bffc0242ed2500f0f2 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Mon, 8 Sep 2025 16:31:31 +0000 Subject: [PATCH 3/4] chore: prepare v1.1.1 hotfix - Update version to 1.1.1 in package.json - Generate release changelog This commit prepares the hotfix/v1.1.1 branch for hotfix. --- CHANGELOG.md | 7 +++++++ package.json | 2 +- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 6401d2c..9280c43 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,10 @@ +## [v1.1.1] - 2025-09-08 + +### Fixed + +- Correct changelog script arguments in create-release workflow (4b1f559) + + ## [v1.1.0] - 2025-09-08 ### Added diff --git a/package.json b/package.json index 3040cf3..8c3f853 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "pico-api-docs", - "version": "1.1.0", + "version": "1.1.1", "description": "PICO SulTeng API Documentation - COVID-19 Sulawesi Tengah Data API", "main": "index.js", "scripts": { From 3901d7a24b7edb17218da763ae26d0c582d7a559 Mon Sep 17 00:00:00 2001 From: Fajrian Aidil Pratama Date: Mon, 8 Sep 2025 23:36:50 +0700 Subject: [PATCH 4/4] docs(CHANGELOG): re-generate changelog --- CHANGELOG.md | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 9280c43..885c2c8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,13 @@ - 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