From f2a4e68ca7695f59b82fe47d5e5fb7af3a12068d Mon Sep 17 00:00:00 2001 From: Moritz Halbritter Date: Mon, 11 Mar 2024 16:10:34 +0100 Subject: [PATCH] Deploy snapshots from GitHub Actions See gh-1508 --- .github/workflows/build.yml | 1 + .github/workflows/deploy-snapshots.yml | 46 ++++++++++++++++++++++++++ 2 files changed, 47 insertions(+) create mode 100644 .github/workflows/deploy-snapshots.yml diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 9eb13172aa..736eaff6f5 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -13,6 +13,7 @@ jobs: matrix: runner: [ ubuntu-latest, windows-latest, macos-latest ] name: Build (${{ matrix.runner }}) + if: ${{ github.repository == 'spring-io/initializr' }} runs-on: ${{ matrix.runner }} steps: - name: Check out diff --git a/.github/workflows/deploy-snapshots.yml b/.github/workflows/deploy-snapshots.yml new file mode 100644 index 0000000000..737725c91f --- /dev/null +++ b/.github/workflows/deploy-snapshots.yml @@ -0,0 +1,46 @@ +name: Deploy snapshots +on: + push: + branches: + - main + workflow_dispatch: +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} +jobs: + build: + name: Deploy snapshots + if: ${{ github.repository == 'spring-io/initializr' }} + runs-on: ubuntu-latest + steps: + - name: Check out + uses: actions/checkout@v4 + + - name: Set up JDK 17 + uses: actions/setup-java@v4 + with: + java-version: '17' + distribution: 'liberica' + cache: 'maven' + + - name: Build with Maven + run: ./mvnw --no-transfer-progress --batch-mode --update-snapshots -Dmaven.repo.local=/tmp/maven-repo install + + - name: Deploy + uses: spring-io/artifactory-deploy-action@90d28f97f3e3735888ffa8648828d5f2f1b1ad21 + with: + uri: 'https://repo.spring.io' + username: ${{ secrets.ARTIFACTORY_USERNAME }} + password: ${{ secrets.ARTIFACTORY_PASSWORD }} + build-name: ${{ format('initializr-{0}', github.ref_name)}} + repository: 'libs-snapshot-local' + folder: '/tmp/maven-repo/io/spring/initializr/' + signing-key: ${{ secrets.GPG_PRIVATE_KEY }} + signing-passphrase: ${{ secrets.GPG_PASSPHRASE }} + + - name: Google Chat Notification + uses: Co-qn/google-chat-notification@3691ccf4763537d6e544bc6cdcccc1965799d056 + with: + name: Deploy snapshots + url: ${{ secrets.GOOGLE_CHAT_WEBHOOK }} + status: ${{ job.status }} + if: always()