From 7b243a52fd9c634bbc1bba4a1bbe77a0b4db8d03 Mon Sep 17 00:00:00 2001 From: Thami Inaflas Date: Mon, 7 Sep 2026 23:50:09 +0200 Subject: [PATCH] feat: add mailing list documentation and automated release workflow --- .github/workflows/auto-release.yml | 114 +++++++++++++++++++++++++++++ .github/workflows/release.yml | 90 ----------------------- docs/docs/mailing-list.md | 1 + 3 files changed, 115 insertions(+), 90 deletions(-) create mode 100644 .github/workflows/auto-release.yml delete mode 100644 .github/workflows/release.yml diff --git a/.github/workflows/auto-release.yml b/.github/workflows/auto-release.yml new file mode 100644 index 0000000..5a33cd1 --- /dev/null +++ b/.github/workflows/auto-release.yml @@ -0,0 +1,114 @@ +name: Auto Release + +on: + push: + branches: + - main + +permissions: + contents: write + +jobs: + release: + runs-on: ubuntu-latest + if: github.repository == 'archyoshi/assertj-json' && !contains(github.event.head_commit.message, 'chore(release)') + steps: + - name: Checkout repository + uses: actions/checkout@v4 + with: + fetch-depth: 0 + token: ${{ secrets.GITHUB_TOKEN }} + + - name: Set up JDK 25 + uses: actions/setup-java@v4 + with: + java-version: '25' + distribution: 'temurin' + cache: maven + + - name: Configure Git + run: | + git config user.name "github-actions[bot]" + git config user.email "github-actions[bot]@users.noreply.github.com" + git config pull.rebase false + + - name: Detect Version and Prepare Release + id: prepare_release + run: | + # Get current version from POM + CURRENT_VERSION=$(./mvnw help:evaluate -Dexpression=project.version -q -DforceStdout) + echo "Current version in POM: $CURRENT_VERSION" + + if [[ "$CURRENT_VERSION" == *-SNAPSHOT ]]; then + RELEASE_VERSION=${CURRENT_VERSION%-SNAPSHOT} + echo "Release version: $RELEASE_VERSION" + echo "RELEASE_VERSION=$RELEASE_VERSION" >> $GITHUB_ENV + echo "SHOULD_RELEASE=true" >> $GITHUB_ENV + + # Remove -SNAPSHOT from POM + ./mvnw -B versions:set -DnewVersion=$RELEASE_VERSION -DgenerateBackupPoms=false + else + echo "Version is not a SNAPSHOT. Skipping release." + echo "SHOULD_RELEASE=false" >> $GITHUB_ENV + fi + + - name: Update Documentation Versions + if: env.SHOULD_RELEASE == 'true' + run: | + find docs/docs -type f -name '*.md' -exec sed -i -E "s|v[0-9]+\.[0-9]+\.[0-9]+(-SNAPSHOT)?|v${{ env.RELEASE_VERSION }}|g" {} + + find docs/docs -type f -name '*.md' -exec sed -i -E "s|assertj-json:v[0-9]+\.[0-9]+\.[0-9]+(-SNAPSHOT)?'|assertj-json:v${{ env.RELEASE_VERSION }}'|g" {} + + + - name: Generate Changelog + if: env.SHOULD_RELEASE == 'true' + run: | + ./mvnw -B git-changelog:git-changelog -Dgit-changelog.toRef=HEAD || true + + - name: Build and Verify + if: env.SHOULD_RELEASE == 'true' + run: ./mvnw -B clean verify + + - name: Commit and Tag Release + if: env.SHOULD_RELEASE == 'true' + run: | + git add pom.xml docs/docs/ + if [ -f CHANGELOG.md ]; then git add CHANGELOG.md; fi + if ! git diff --staged --quiet; then + git commit -m "chore(release): release version ${{ env.RELEASE_VERSION }} [skip ci]" + git push origin main + fi + git tag -a "v${{ env.RELEASE_VERSION }}" -m "Release v${{ env.RELEASE_VERSION }}" + git push origin "v${{ env.RELEASE_VERSION }}" + + - name: Create GitHub Release + if: env.SHOULD_RELEASE == 'true' + uses: softprops/action-gh-release@v2 + with: + tag_name: "v${{ env.RELEASE_VERSION }}" + name: "v${{ env.RELEASE_VERSION }}" + generate_release_notes: true + files: | + target/*.jar + + - name: Bump Next Snapshot on Develop Branch + if: env.SHOULD_RELEASE == 'true' + run: | + # Calculate next patch version + IFS='.' read -r -a VERSION_PARTS <<< "${{ env.RELEASE_VERSION }}" + PATCH=$((VERSION_PARTS[2] + 1)) + NEXT_VERSION="${VERSION_PARTS[0]}.${VERSION_PARTS[1]}.${PATCH}-SNAPSHOT" + echo "Next version: $NEXT_VERSION" + + git fetch origin develop + git checkout -B develop origin/develop + + # Merge main (which has the release commit) into develop + git merge main -m "chore: merge main into develop [skip ci]" --strategy-option=theirs || true + + # Bump to next snapshot + ./mvnw -B versions:set -DnewVersion=$NEXT_VERSION -DgenerateBackupPoms=false + + git add pom.xml + if ! git diff --staged --quiet; then + git commit -m "chore: prepare next development iteration $NEXT_VERSION [skip ci]" + git push origin develop + fi diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml deleted file mode 100644 index b7a6c3a..0000000 --- a/.github/workflows/release.yml +++ /dev/null @@ -1,90 +0,0 @@ -name: Release - -on: - workflow_dispatch: - inputs: - release_version: - description: 'Release version (e.g. 0.1.0)' - required: true - type: string - next_version: - description: 'Next development snapshot version (e.g. 0.2.0-SNAPSHOT)' - required: true - type: string - release_branch: - description: 'Branch to release from' - required: false - default: 'main' - type: string - develop_branch: - description: 'Development branch to update snapshot version' - required: false - default: 'develop' - type: string - -permissions: - contents: write - -jobs: - release: - runs-on: ubuntu-latest - steps: - - name: Checkout repository - uses: actions/checkout@v4 - with: - fetch-depth: 0 - token: ${{ secrets.GITHUB_TOKEN }} - - - name: Set up JDK 25 - uses: actions/setup-java@v4 - with: - java-version: '25' - distribution: 'temurin' - cache: maven - - - name: Configure Git - run: | - git config user.name "github-actions[bot]" - git config user.email "github-actions[bot]@users.noreply.github.com" - git config pull.rebase false - - - name: Prepare Release Version - run: | - git fetch origin ${{ inputs.release_branch }} - git checkout -B ${{ inputs.release_branch }} origin/${{ inputs.release_branch }} - ./mvnw -B versions:set -DnewVersion=${{ inputs.release_version }} -DgenerateBackupPoms=false - ./mvnw -B git-changelog:git-changelog -Dgit-changelog.toRef=HEAD || true - ./mvnw -B clean verify - - - name: Commit and Tag Release - run: | - git add pom.xml - if [ -f CHANGELOG.md ]; then git add CHANGELOG.md; fi - if ! git diff --staged --quiet; then - git commit -m "chore(release): release version ${{ inputs.release_version }}" - git push origin ${{ inputs.release_branch }} - fi - git tag -a "v${{ inputs.release_version }}" -m "Release v${{ inputs.release_version }}" - git push origin "v${{ inputs.release_version }}" - - - name: Create GitHub Release - uses: softprops/action-gh-release@v2 - with: - tag_name: "v${{ inputs.release_version }}" - name: "v${{ inputs.release_version }}" - generate_release_notes: true - files: | - target/*.jar - - - name: Bump Next Snapshot on Develop Branch - run: | - git fetch origin ${{ inputs.develop_branch }} - git checkout -B ${{ inputs.develop_branch }} origin/${{ inputs.develop_branch }} - git merge origin/${{ inputs.release_branch }} -m "chore: merge ${{ inputs.release_branch }} into ${{ inputs.develop_branch }} [skip ci]" --strategy-option=theirs || true - ./mvnw -B versions:set -DnewVersion=${{ inputs.next_version }} -DgenerateBackupPoms=false - ./mvnw -B clean compile - git add pom.xml - if ! git diff --staged --quiet; then - git commit -m "chore: prepare next development iteration ${{ inputs.next_version }}" - git push origin ${{ inputs.develop_branch }} - fi diff --git a/docs/docs/mailing-list.md b/docs/docs/mailing-list.md index 095961f..ddccb2d 100644 --- a/docs/docs/mailing-list.md +++ b/docs/docs/mailing-list.md @@ -1,6 +1,7 @@ --- title: Mailing List sidebar_position: 6 +draft: true --- # Mailing List