From 049399e6f8a49b5482688a85969c7ab69228b6cd Mon Sep 17 00:00:00 2001 From: ndr_brt Date: Wed, 4 Sep 2024 17:24:35 +0200 Subject: [PATCH] ci: improve release preparation --- .github/actions/bump-version/action.yml | 15 ++------- .github/workflows/bump-version.yaml | 20 ----------- .github/workflows/core-prepare-release.yml | 39 +++++++++++++++------- .github/workflows/technology-release.yml | 1 - 4 files changed, 30 insertions(+), 45 deletions(-) delete mode 100644 .github/workflows/bump-version.yaml diff --git a/.github/actions/bump-version/action.yml b/.github/actions/bump-version/action.yml index d31189c..2641f91 100644 --- a/.github/actions/bump-version/action.yml +++ b/.github/actions/bump-version/action.yml @@ -1,10 +1,6 @@ name: "Bump version in gradle.properties" -description: "Increments the patch version of the version found in gradle.properties, appends -SNAPSHOT" +description: "Increments the minor version of the version found in gradle.properties, appends -SNAPSHOT" inputs: - target_branch: - default: 'main' - description: "Branch on which the version bump is to be done." - required: false base_version: description: "The current version, which is to be bumped to the next snapshot" required: false @@ -12,18 +8,13 @@ inputs: runs: using: "composite" steps: - - uses: actions/checkout@v4 - - name: read version from gradle.properties + - name: bump current ${{ inputs.base_version }} version shell: bash run: | # Prepare git env git config user.name "eclipse-edc-bot" git config user.email "edc-bot@eclipse.org" - # checkout target - git fetch origin - git checkout ${{ inputs.target_branch }} - # use current version from input baseVersion=${{ inputs.base_version }} existingVersion=$(grep "version" gradle.properties | awk -F= '{print $2}') @@ -52,4 +43,4 @@ runs: git add . git commit --message "Bump version from $baseVersion to $newVersion [skip ci]" - git push origin ${{ inputs.target_branch }} + git push diff --git a/.github/workflows/bump-version.yaml b/.github/workflows/bump-version.yaml deleted file mode 100644 index 3cb050e..0000000 --- a/.github/workflows/bump-version.yaml +++ /dev/null @@ -1,20 +0,0 @@ ---- -name: "Bump version (manually)" - -on: - workflow_call: - inputs: - target_branch: - required: false - type: string - -jobs: - Bump-Version: - name: 'Update snapshot version' - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - - uses: eclipse-edc/.github/.github/actions/bump-version@main - name: Bump version - with: - target_branch: ${{ inputs.target_branch }} \ No newline at end of file diff --git a/.github/workflows/core-prepare-release.yml b/.github/workflows/core-prepare-release.yml index 230d229..bccf8af 100644 --- a/.github/workflows/core-prepare-release.yml +++ b/.github/workflows/core-prepare-release.yml @@ -47,13 +47,27 @@ jobs: git push origin $RELEASE_REF echo "RELEASE_REF=$RELEASE_REF" >> $GITHUB_OUTPUT - Publish-Snapshot: + Bump-Main-Version: + if: github.ref_name == 'main' needs: [ Prepare-Release ] runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 with: - ref: ${{ needs.Prepare-Release.outputs.RELEASE_REF }} + ref: main + - uses: eclipse-edc/.github/.github/actions/bump-version@main + with: + base_version: ${{ inputs.version }} + + Publish-Main-Snapshot: + # publish snapshot artifacts for the next x.y.0 version + if: github.ref_name == 'main' + needs: [ Bump-Main-Version ] + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + with: + ref: main - uses: eclipse-edc/.github/.github/actions/publish-maven-artifacts@main with: @@ -62,19 +76,20 @@ jobs: osshr-username: ${{ secrets.ORG_OSSRH_USERNAME }} osshr-password: ${{ secrets.ORG_OSSRH_PASSWORD }} - Bump-Main-Version: - if: github.ref_name == 'main' + Publish-Bugfix-Snapshot: + # publish snapshot artifacts from the bugfix branch (RELEASE_REF) only for bugfix releases (that does not start from main) + if: github.ref_name != 'main' needs: [ Prepare-Release ] runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - - uses: eclipse-edc/.github/.github/actions/bump-version@main with: - target_branch: main - base_version: ${{ inputs.version }} + ref: ${{ needs.Prepare-Release.outputs.RELEASE_REF }} + + - uses: eclipse-edc/.github/.github/actions/publish-maven-artifacts@main + with: + gpg-private-key: ${{ secrets.ORG_GPG_PRIVATE_KEY }} + gpg-passphrase: ${{ secrets.ORG_GPG_PASSPHRASE }} + osshr-username: ${{ secrets.ORG_OSSRH_USERNAME }} + osshr-password: ${{ secrets.ORG_OSSRH_PASSWORD }} - Publish-Main-Snapshot: - if: github.ref_name == 'main' - needs: [ Bump-Main-Version ] - uses: eclipse-edc/.github/.github/workflows/publish-snapshot.yml@main - secrets: inherit diff --git a/.github/workflows/technology-release.yml b/.github/workflows/technology-release.yml index 9d64152..9c3368f 100644 --- a/.github/workflows/technology-release.yml +++ b/.github/workflows/technology-release.yml @@ -62,7 +62,6 @@ jobs: - uses: actions/checkout@v4 - uses: eclipse-edc/.github/.github/actions/bump-version@main with: - target_branch: main base_version: ${{ needs.Create-Tag.outputs.VERSION }} Post-To-Discord: