From 5175a14ba11d1e654839221b064d7c8a8a5d4472 Mon Sep 17 00:00:00 2001 From: Dave Syer Date: Wed, 10 Jul 2024 17:24:48 +0100 Subject: [PATCH] Switch CI to Github for main --- .github/workflows/maven.yml | 11 +-- .github/workflows/push.yml | 37 ++++++++++ .travis.yml | 8 --- pipeline.yml | 130 ------------------------------------ 4 files changed, 43 insertions(+), 143 deletions(-) create mode 100644 .github/workflows/push.yml delete mode 100644 .travis.yml delete mode 100644 pipeline.yml diff --git a/.github/workflows/maven.yml b/.github/workflows/maven.yml index 3384681..f22dd88 100644 --- a/.github/workflows/maven.yml +++ b/.github/workflows/maven.yml @@ -4,23 +4,24 @@ name: Java CI with Maven on: - push: - branches: [ main ] pull_request: branches: [ main ] jobs: build: + name: Build Pull Request runs-on: ubuntu-latest + if: ${{ github.repository == 'spring-projects/spring-guice' }} steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v4 - name: Set up JDK 17 - uses: actions/setup-java@v2 + uses: actions/setup-java@v4 with: java-version: '17' distribution: 'temurin' cache: maven - name: Build with Maven - run: mvn -B package --file pom.xml + run: ./mvnw -B package + diff --git a/.github/workflows/push.yml b/.github/workflows/push.yml new file mode 100644 index 0000000..c002be5 --- /dev/null +++ b/.github/workflows/push.yml @@ -0,0 +1,37 @@ +# This workflow will build a Java project with Maven, and cache/restore any dependencies to improve the workflow execution time +# For more information see: https://help.github.com/actions/language-and-framework-guides/building-and-testing-java-with-maven + +name: Java CI with Maven Deploy + +on: + push: + branches: [ main ] + +jobs: + build: + name: Build and Deploy On Push + + runs-on: ubuntu-latest + if: ${{ github.repository == 'spring-projects/spring-guice' }} + + steps: + - uses: actions/checkout@v4 + - name: Set up JDK 17 + uses: actions/setup-java@v4 + with: + java-version: '17' + distribution: 'temurin' + cache: maven + - name: Deploy with Maven + env: + spring_username: ${{ secrets.ARTIFACTORY_USERNAME }} + spring_password: ${{ secrets.ARTIFACTORY_PASSWORD }} + sonatype_username: ${{ secrets.SONATYPE_USERNAME }} + sonatype_password: ${{ secrets.SONATYPE_PASSWORD }} + signing_key: ${{ secrets.GPG_PRIVATE_KEY }} + passphrase: ${{ secrets.GPG_PASSPHRASE }} + run: | + echo "${signing_key}" > private.asc + gpg --import --batch --no-tty private.asc + ./mvnw -B deploy -s .mvn/settings.xml + diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 0b861e4..0000000 --- a/.travis.yml +++ /dev/null @@ -1,8 +0,0 @@ -language: java -jdk: - - openjdk17 -cache: - directories: - - $HOME/.m2 - -install: mvn install diff --git a/pipeline.yml b/pipeline.yml deleted file mode 100644 index 08ad0c9..0000000 --- a/pipeline.yml +++ /dev/null @@ -1,130 +0,0 @@ -# fly --target spring-team login --concourse-url https://ci.spring.io --team-name "spring-guice" -# fly --target spring-team set-pipeline --config pipeline.yml --pipeline spring-guice --load-vars-from credentials.yml ---- -resource_types: -- name: slack-notification - type: registry-image - source: - repository: harbor-repo.vmware.com/dockerhub-proxy-cache/nebhale/slack-notification-resource - tag: latest - -resources: -- name: source - type: git - source: - uri: https://github.com/spring-projects/spring-guice.git -- name: slack - type: slack-notification - source: - url: {{slack-url}} - -slack-failure: &slack-failure - put: slack - params: - attachments: - - color: danger - fallback: "$BUILD_PIPELINE_NAME/$BUILD_JOB_NAME #$BUILD_NAME " - text: " Build has failed" - title: "$BUILD_PIPELINE_NAME/$BUILD_JOB_NAME #$BUILD_NAME" - title_link: $ATC_EXTERNAL_URL/teams/$BUILD_TEAM_NAME/pipelines/$BUILD_PIPELINE_NAME/jobs/$BUILD_JOB_NAME/builds/$BUILD_NAME - -slack-success: &slack-success - put: slack - params: - attachments: - - color: good - fallback: "$BUILD_PIPELINE_NAME/$BUILD_JOB_NAME #$BUILD_NAME " - text: "Build has succeeded" - title: "$BUILD_PIPELINE_NAME/$BUILD_JOB_NAME #$BUILD_NAME" - title_link: $ATC_EXTERNAL_URL/teams/$BUILD_TEAM_NAME/pipelines/$BUILD_PIPELINE_NAME/jobs/$BUILD_JOB_NAME/builds/$BUILD_NAME - -jobs: -- name: build - plan: - - get: source - trigger: true - - task: build - config: - platform: linux - image_resource: - type: registry-image - source: - repository: harbor-repo.vmware.com/dockerhub-proxy-cache/springci/spring-framework-ci - tag: 5.3.x - inputs: - - name: source - caches: - - path: .m2 - run: - dir: source - path: sh - args: - - -c - - | - rm -rf ~/.m2 - ln -s $(pwd)/../.m2 ~/.m2 - ./mvnw install -Dgpg.skip=true -- name: next - plan: - - get: source - trigger: true - - task: build - config: - platform: linux - image_resource: - type: registry-image - source: - repository: harbor-repo.vmware.com/dockerhub-proxy-cache/springci/spring-framework-ci - tag: 6.0.x - inputs: - - name: source - caches: - - path: .m2 - run: - dir: source - path: sh - args: - - -c - - | - rm -rf ~/.m2 - ln -s $(pwd)/../.m2 ~/.m2 - ./mvnw install -Dspring.version=6.0.3 -Dgpg.skip=true -- name: deploy - plan: - - get: source - trigger: true - passed: [build, next] - - task: deploy - config: - platform: linux - image_resource: - type: registry-image - source: - repository: harbor-repo.vmware.com/dockerhub-proxy-cache/springci/spring-framework-ci - tag: 5.3.x - inputs: - - name: source - caches: - - path: .m2 - run: - dir: source - path: sh - args: - - -c - - | - apt update && apt install gpg -y - rm -rf ~/.m2 - ln -s $(pwd)/../.m2 ~/.m2 - echo "((signing-key))" > private.asc - gpg --import --batch --no-tty private.asc - ./mvnw deploy -DskipTests -s .mvn/settings.xml - params: - TERM: dumb - passphrase: ((signing-passphrase)) - sonatype_username: ((sonatype-username)) - sonatype_password: ((sonatype-password)) - spring_username: ((artifactory-username)) - spring_password: ((artifactory-password)) - on_failure: *slack-failure - on_success: *slack-success -