From ccff153637a96727e4a1341d49ab6424f6a4b976 Mon Sep 17 00:00:00 2001 From: Fred Deniger Date: Thu, 4 Jul 2024 18:07:07 +0200 Subject: [PATCH] use github for actions --- .github/workflows/build.yml | 19 +++++++++++ .github/workflows/build_publish.yaml | 23 ------------- .github/workflows/deploy.yml | 25 ++++++++++++++ .github/workflows/release.yml | 51 ++++++++++++++++++++++++++++ .github/workflows/validate_pr.yml | 22 ------------ 5 files changed, 95 insertions(+), 45 deletions(-) create mode 100644 .github/workflows/build.yml delete mode 100644 .github/workflows/build_publish.yaml create mode 100644 .github/workflows/deploy.yml create mode 100644 .github/workflows/release.yml delete mode 100644 .github/workflows/validate_pr.yml diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 000000000..ba29fb0d6 --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,19 @@ +name: Verify on PRs + +on: + pull_request: + branches: [1.6.x] + +jobs: + build: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - name: Set up JDK + uses: actions/setup-java@v3 + with: + java-version: '11' + distribution: 'adopt' + cache: 'maven' + - name: Build with Maven + run: mvn --batch-mode --update-snapshots verify \ No newline at end of file diff --git a/.github/workflows/build_publish.yaml b/.github/workflows/build_publish.yaml deleted file mode 100644 index 826e8a6b2..000000000 --- a/.github/workflows/build_publish.yaml +++ /dev/null @@ -1,23 +0,0 @@ -name: Build and Publish package -on: - push: - branches: [ master ] - -jobs: - build-publish-package: - name: Build and Publish package - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v2 - - name: Set up JDK 1.8 - uses: actions/setup-java@v1 - with: - java-version: 1.8 - server-id: nexus-sonatype - server-username: NEXUS_USERNAME - server-password: NEXUS_PASSWORD - - name: Build and deploy with Maven - run: ./mvnw --no-transfer-progress clean -U deploy - env: - NEXUS_USERNAME: ${{ secrets.NEXUS_USERNAME }} - NEXUS_PASSWORD: ${{ secrets.NEXUS_PASSWORD }} diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml new file mode 100644 index 000000000..e05285ccb --- /dev/null +++ b/.github/workflows/deploy.yml @@ -0,0 +1,25 @@ +# this build is designed to replicate the Travis CI workflow +name: Deploy SNAPSHOT Version on Main branch + +on: + push: + branches: [1.6.x] + +jobs: + deploy: + runs-on: ubuntu-latest + permissions: + contents: read + packages: write + steps: + - uses: actions/checkout@v3 + - name: Set up JDK + uses: actions/setup-java@v3 + with: + java-version: '11' + distribution: 'adopt' + cache: 'maven' + - name: Deploy SNAPSHOT with Maven + run: mvn --batch-mode deploy + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 000000000..238e5f763 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,51 @@ +name: Do Release + +on: + workflow_dispatch: + +jobs: + deploy: + runs-on: ubuntu-latest + permissions: write-all + steps: + - uses: actions/checkout@v3 + - name: Set up JDK + uses: actions/setup-java@v3 + with: + java-version: '11' + distribution: 'adopt' + cache: 'maven' + server-id: github + - name: Git Config + run: | + git config user.email "actions@github.com" + git config user.name "GitHub Actions" + - name: Remove snapshot + run: mvn versions:set -DremoveSnapshot=true -DgenerateBackupPoms=false + - name: Release with Maven + run: mvn --batch-mode deploy + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + - name: Git tag + run: | + CURRENT_PROJECT_VERSION=$(mvn -q -Dexec.executable=echo -Dexec.args='${project.version}' --non-recursive exec:exec) + git commit -a -m "[skip ci] release $CURRENT_PROJECT_VERSION" + git tag "$CURRENT_PROJECT_VERSION" + git push origin "$CURRENT_PROJECT_VERSION" + gh release create $CURRENT_PROJECT_VERSION + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + - name: Move to next snapshot + run: mvn versions:set -DnextSnapshot=true -DgenerateBackupPoms=false + + - name: Create Branch for next Snapshot Version + run: | + CURRENT_PROJECT_VERSION=$(mvn -q -Dexec.executable=echo -Dexec.args='${project.version}' --non-recursive exec:exec) + BRANCH_NAME="move-to-$CURRENT_PROJECT_VERSION" + git checkout -b "$BRANCH_NAME" + git commit -a -m "[skip ci] change version to new snapshot $CURRENT_PROJECT_VERSION" + git push origin "$BRANCH_NAME" + gh pr create -B main -H $BRANCH_NAME --title "Update Version to $CURRENT_PROJECT_VERSION" --body 'Created by "Do Release" workflow' + echo "Please, accept the PR: Update Version to $CURRENT_PROJECT_VERSION" + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} \ No newline at end of file diff --git a/.github/workflows/validate_pr.yml b/.github/workflows/validate_pr.yml deleted file mode 100644 index d407000d1..000000000 --- a/.github/workflows/validate_pr.yml +++ /dev/null @@ -1,22 +0,0 @@ -# This workflow will build a Java project with Maven -# For more information see: https://help.github.com/actions/language-and-framework-guides/building-and-testing-java-with-maven - -name: Java CI with Maven - -on: - pull_request: - branches: [ master ] - -jobs: - build: - - runs-on: ubuntu-latest - - steps: - - uses: actions/checkout@v2 - - name: Set up JDK 1.8 - uses: actions/setup-java@v1 - with: - java-version: 1.8 - - name: Build with Maven - run: mvn clean package