From 53c4d464246b99c313ee7bbb8f801961e6ccb3b3 Mon Sep 17 00:00:00 2001 From: ndr_brt Date: Thu, 18 Jan 2024 15:14:57 +0100 Subject: [PATCH] build: make trigger snapshot be manually triggerable (#38) --- .github/actions/bump-version/action.yml | 54 ------------------------- .github/actions/run-tests/action.yml | 21 ---------- .github/actions/setup-build/action.yml | 9 ----- .github/workflows/bump-version.yaml | 5 +-- .github/workflows/ci.yaml | 10 ++--- .github/workflows/release-rm.yml | 4 +- .github/workflows/trigger_snapshot.yml | 1 + 7 files changed, 10 insertions(+), 94 deletions(-) delete mode 100644 .github/actions/bump-version/action.yml delete mode 100644 .github/actions/run-tests/action.yml delete mode 100644 .github/actions/setup-build/action.yml diff --git a/.github/actions/bump-version/action.yml b/.github/actions/bump-version/action.yml deleted file mode 100644 index 54ea494..0000000 --- a/.github/actions/bump-version/action.yml +++ /dev/null @@ -1,54 +0,0 @@ -name: "Bump version in gradle.properties" -description: "Increments the patch 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 - -runs: - using: "composite" - steps: - - uses: actions/checkout@v3 - - name: read version from gradle.properties - 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}') - - # read the major, minor, and patch components, consume -SNAPSHOT - IFS=.- read -r RELEASE_VERSION_MAJOR RELEASE_VERSION_MINOR RELEASE_VERSION_PATCH SNAPSHOT<<<"$baseVersion" - INC=0 - # Compute new snapshot version, do not increment snapshot on non-final releases, e.g. -rc1 - if [ -z $SNAPSHOT ]; then - echo "$baseVersion is a final release version, increase patch for next snapshot" - INC=1 - else - echo "$baseVersion is not a final release version (contains \"$SNAPSHOT\"), will not increase patch" - fi - - # construct the new version - newVersion="$RELEASE_VERSION_MAJOR.$RELEASE_VERSION_MINOR.$((RELEASE_VERSION_PATCH+$INC))"-SNAPSHOT - - # replace every occurrence of =$baseVersion with =$newVersion - grep -rlz "$existingVersion" . --exclude=\*.{sh,bin} | xargs sed -i "s/$existingVersion/$newVersion/g" - - echo "Bumped the version from $baseVersion to $newVersion" - - # Commit and push to the desired branch, defaults to 'main' - git add . - git commit --message "Bump version from $baseVersion to $newVersion [skip ci]" - - git push origin ${{ inputs.target_branch }} diff --git a/.github/actions/run-tests/action.yml b/.github/actions/run-tests/action.yml deleted file mode 100644 index 0080061..0000000 --- a/.github/actions/run-tests/action.yml +++ /dev/null @@ -1,21 +0,0 @@ -name: "Run tests" -description: "Run tests and archive test results for subsequent publication" -inputs: - command: - required: true - description: "The shell command to run tests" -runs: - using: "composite" - steps: - - name: Run Tests - shell: bash - run: ${{ inputs.command }} - - - name: Upload Test Results - uses: actions/upload-artifact@v3 - if: always() - with: - name: Test Results ${{ github.job }} - path: | - **/test-results/**/*.xml - **/build/reports/jacoco/test/jacocoTestReport.xml diff --git a/.github/actions/setup-build/action.yml b/.github/actions/setup-build/action.yml deleted file mode 100644 index 9ff6e6b..0000000 --- a/.github/actions/setup-build/action.yml +++ /dev/null @@ -1,9 +0,0 @@ -name: "Setup Gradle" -description: "Setup Gradle" -runs: - using: "composite" - steps: - - uses: actions/setup-java@v3 - with: - java-version: '17' - distribution: 'temurin' diff --git a/.github/workflows/bump-version.yaml b/.github/workflows/bump-version.yaml index 3b1d9c4..cd4b418 100644 --- a/.github/workflows/bump-version.yaml +++ b/.github/workflows/bump-version.yaml @@ -10,14 +10,13 @@ on: description: "Branch on which the version bump is to be done." required: false - jobs: Bump-Version: name: 'Update snapshot version' runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - - uses: ./.github/actions/bump-version + - uses: eclipse-edc/.github/.github/actions/bump-version@main name: Bump version with: - target_branch: ${{ inputs.target_branch }} \ No newline at end of file + target_branch: ${{ inputs.target_branch }} diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 92d5c87..4ab3a2b 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -26,7 +26,7 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - - uses: ./.github/actions/setup-build + - uses: eclipse-edc/.github/.github/actions/setup-build@main - name: Run Checkstyle run: ./gradlew checkstyleMain checkstyleTest @@ -35,7 +35,7 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - - uses: ./.github/actions/setup-build + - uses: eclipse-edc/.github/.github/actions/setup-build@main - name: Run Javadoc run: ./gradlew javadoc @@ -45,10 +45,10 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - - uses: ./.github/actions/setup-build + - uses: eclipse-edc/.github/.github/actions/setup-build@main - name: Run unit tests - uses: ./.github/actions/run-tests + uses: eclipse-edc/.github/.github/actions/run-tests@main with: command: ./gradlew test @@ -57,4 +57,4 @@ jobs: needs: [ Checkstyle, Javadoc, Unit-Tests ] if: github.repository == 'eclipse-edc/Runtime-Metamodel' && github.event_name == 'push' && github.ref_name == 'main' uses: eclipse-edc/.github/.github/workflows/publish-snapshot.yml@main - secrets: inherit \ No newline at end of file + secrets: inherit diff --git a/.github/workflows/release-rm.yml b/.github/workflows/release-rm.yml index f9f66d3..45eee5a 100644 --- a/.github/workflows/release-rm.yml +++ b/.github/workflows/release-rm.yml @@ -69,7 +69,7 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - - uses: ./.github/actions/bump-version + - uses: eclipse-edc/.github/.github/actions/bump-version@main with: target_branch: "main" - base_version: ${{ needs.Prepare-Release.outputs.edc-version }} \ No newline at end of file + base_version: ${{ needs.Prepare-Release.outputs.edc-version }} diff --git a/.github/workflows/trigger_snapshot.yml b/.github/workflows/trigger_snapshot.yml index 6c60269..885cdd5 100644 --- a/.github/workflows/trigger_snapshot.yml +++ b/.github/workflows/trigger_snapshot.yml @@ -4,6 +4,7 @@ on: push: branches: - main + workflow_dispatch: jobs: Publish-Snapshot: