diff --git a/.github/workflows/release-changelog-internal.yml b/.github/workflows/release-changelog-internal.yml index 5d96ef4c..1bdcae27 100644 --- a/.github/workflows/release-changelog-internal.yml +++ b/.github/workflows/release-changelog-internal.yml @@ -11,7 +11,7 @@ jobs: uses: ./.github/workflows/release-changelog.yml with: branch: 'master' - tag_format: X.Y.Z + tag_format: vX.Y.Z release_tag: ${{ github.ref_name }} secrets: GITHUB: ${{ secrets.GITHUB }} diff --git a/.github/workflows/release-changelog.yml b/.github/workflows/release-changelog.yml index b896f3cf..3eed6b2c 100644 --- a/.github/workflows/release-changelog.yml +++ b/.github/workflows/release-changelog.yml @@ -17,14 +17,6 @@ on: required: true type: string description: "Actual release tag to validate and use" - version_type: - required: true - type: string - description: "Type of release (major/minor/patch)" - latest_tag: - required: true - type: string - description: "Previous tag for comparison" secrets: GITHUB: @@ -108,14 +100,7 @@ jobs: allowUpdates: true draft: false makeLatest: true - body: | - ${{ steps.changelog.outputs.changes }} - - **Release Type:** ${{ inputs.version_type }} - - ${{ inputs.version_type == 'major' && '⚠️ **BREAKING CHANGES:** This is a major release with breaking changes. Please review the breaking changes section in [CHANGELOG.md](https://github.com/${{ github.repository }}/blob/${{ inputs.release_tag }}/CHANGELOG.md) before upgrading.' || '' }} - - [Compare changes](https://github.com/${{ github.repository }}/compare/${{ inputs.latest_tag }}...${{ inputs.release_tag }}) + body: ${{ steps.changelog.outputs.changes }} - name: 💾 Commit CHANGELOG.md uses: stefanzweifel/git-auto-commit-action@v7 diff --git a/.github/workflows/release-tag.yml b/.github/workflows/release-tag.yml index 66ed5f7f..b5166bfe 100644 --- a/.github/workflows/release-tag.yml +++ b/.github/workflows/release-tag.yml @@ -18,6 +18,11 @@ on: type: boolean default: true description: "Whether to create changelog and release (default: true)" + latest_tag: + required: false + type: string + description: "Previous tag for comparison (optional - will be auto-detected if not provided)" + secrets: GITHUB: required: true @@ -67,14 +72,24 @@ jobs: echo "reason=no valid label found, skipping" >> $GITHUB_OUTPUT fi - - name: 🔖 Get latest tag (or 1.0.0 if none) + - name: 🔖 Get latest tag (or use provided latest_tag or default to 1.0.0) id: get_latest_tag if: steps.skip_tag.outputs.skip == 'false' run: | - git fetch --tags - LATEST_TAG=$(git tag --list --sort=-v:refname | head -n 1) - if [ -z "$LATEST_TAG" ]; then - LATEST_TAG="1.0.0" + # First, check if latest_tag was provided as input + if [ -n "${{ inputs.latest_tag }}" ]; then + LATEST_TAG="${{ inputs.latest_tag }}" + echo "Using provided latest_tag: $LATEST_TAG" + else + # Otherwise, fetch from git tags + git fetch --tags + LATEST_TAG=$(git tag --list --sort=-v:refname | head -n 1) + if [ -z "$LATEST_TAG" ]; then + LATEST_TAG="1.0.0" + echo "No existing tags found, defaulting to: $LATEST_TAG" + else + echo "Found latest tag from git: $LATEST_TAG" + fi fi echo "latest_tag=$LATEST_TAG" >> $GITHUB_OUTPUT @@ -137,7 +152,5 @@ jobs: branch: ${{ inputs.target_branch }} tag_format: ${{ inputs.tag_format }} release_tag: ${{ needs.create-tag.outputs.final_tag }} - version_type: ${{ needs.create-tag.outputs.version_type }} - latest_tag: ${{ needs.create-tag.outputs.latest_tag }} secrets: GITHUB: ${{ secrets.GITHUB }} diff --git a/docs/release-tag.md b/docs/release-tag.md index a31f5df0..df0b36ea 100644 --- a/docs/release-tag.md +++ b/docs/release-tag.md @@ -42,6 +42,7 @@ jobs: target_branch: ${{ github.event.pull_request.base.ref }} tag_format: "vX.Y.Z" # or "X.Y.Z" depending on your preference # create_changelog: false # 👈 Disable changelog generation + # latest_tag: ${{ github.event.inputs.base_tag }} # "" # 👈 latest_tag is optional - will be auto-detected secrets: GITHUB: ${{ secrets.TOKEN_GITHUB }} ``` \ No newline at end of file