Skip to content

Commit 9298ef5

Browse files
committed
Add GitHub action for building and deploying SNAPSHOTs
See gh-939
1 parent b9d4cbc commit 9298ef5

File tree

3 files changed

+110
-41
lines changed

3 files changed

+110
-41
lines changed
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
name: Send notification
2+
description: Sends a Google Chat message as a notification of the job's outcome
3+
inputs:
4+
webhook-url:
5+
description: 'Google Chat Webhook URL'
6+
required: true
7+
status:
8+
description: 'Status of the job'
9+
required: true
10+
build-scan-url:
11+
description: 'URL of the build scan to include in the notification'
12+
run-name:
13+
description: 'Name of the run to include in the notification'
14+
default: ${{ format('{0} {1}', github.ref_name, github.job) }}
15+
runs:
16+
using: composite
17+
steps:
18+
- shell: bash
19+
run: |
20+
echo "BUILD_SCAN=${{ inputs.build-scan-url == '' && ' [build scan unavailable]' || format(' [<{0}|Build Scan>]', inputs.build-scan-url) }}" >> "$GITHUB_ENV"
21+
echo "RUN_URL=${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}" >> "$GITHUB_ENV"
22+
- shell: bash
23+
if: ${{ inputs.status == 'success' }}
24+
run: |
25+
curl -X POST '${{ inputs.webhook-url }}' -H 'Content-Type: application/json' -d '{ text: "<${{ env.RUN_URL }}|${{ inputs.run-name }}> was successful ${{ env.BUILD_SCAN }}"}' || true
26+
- shell: bash
27+
if: ${{ inputs.status == 'failure' }}
28+
run: |
29+
curl -X POST '${{ inputs.webhook-url }}' -H 'Content-Type: application/json' -d '{ text: "<users/all> *<${{ env.RUN_URL }}|${{ inputs.run-name }}> failed* ${{ env.BUILD_SCAN }}"}' || true
30+
- shell: bash
31+
if: ${{ inputs.status == 'cancelled' }}
32+
run: |
33+
curl -X POST '${{ inputs.webhook-url }}' -H 'Content-Type: application/json' -d '{ text: "<${{ env.RUN_URL }}|${{ inputs.run-name }}> was cancelled"}' || true
Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
name: Build and deploy snapshot
2+
on:
3+
push:
4+
branches:
5+
- 1.2.x
6+
concurrency:
7+
group: ${{ github.workflow }}-${{ github.ref }}
8+
jobs:
9+
build:
10+
if: ${{ github.repository == 'spring-projects/spring-graphql' }}
11+
name: Build and deploy snapshot
12+
runs-on: ubuntu-latest
13+
steps:
14+
- name: Set up Java
15+
uses: actions/setup-java@99b8673ff64fbf99d8d325f52d9a5bdedb8483e9 # v4.2.1
16+
with:
17+
distribution: 'liberica'
18+
java-version: 17
19+
- name: Check out code
20+
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
21+
- name: Set up Gradle
22+
uses: gradle/actions/setup-gradle@417ae3ccd767c252f5661f1ace9f835f9654f2b5 # v3.1.0
23+
with:
24+
cache-read-only: ${{ github.ref != 'refs/heads/main' || !endsWith(github.ref, '.x') }}
25+
- name: Configure Gradle properties
26+
shell: bash
27+
run: |
28+
mkdir -p $HOME/.gradle
29+
echo 'systemProp.user.name=spring-builds+github' >> $HOME/.gradle/gradle.properties
30+
echo 'systemProp.org.gradle.internal.launcher.welcomeMessageEnabled=false' >> $HOME/.gradle/gradle.properties
31+
echo 'org.gradle.daemon=false' >> $HOME/.gradle/gradle.properties
32+
- name: Build and publish
33+
id: build
34+
env:
35+
CI: 'true'
36+
GRADLE_ENTERPRISE_URL: 'https://ge.spring.io'
37+
GRADLE_ENTERPRISE_ACCESS_KEY: ${{ secrets.GRADLE_ENTERPRISE_SECRET_ACCESS_KEY }}
38+
GRADLE_ENTERPRISE_CACHE_USERNAME: ${{ secrets.GRADLE_ENTERPRISE_CACHE_USER }}
39+
GRADLE_ENTERPRISE_CACHE_PASSWORD: ${{ secrets.GRADLE_ENTERPRISE_CACHE_PASSWORD }}
40+
run: ./gradlew -PdistributionRepository=$(pwd)/deployment-repository build publishAllPublicationsToDistributionRepository
41+
- name: Deploy
42+
uses: spring-io/artifactory-deploy-action@26bbe925a75f4f863e1e529e85be2d0093cac116 # v0.0.1
43+
with:
44+
uri: 'https://repo.spring.io'
45+
username: ${{ secrets.ARTIFACTORY_USERNAME }}
46+
password: ${{ secrets.ARTIFACTORY_PASSWORD }}
47+
build-name: ${{ format('spring-graphql-{0}', github.ref_name)}}
48+
repository: 'libs-snapshot-local'
49+
folder: 'deployment-repository'
50+
signing-key: ${{ secrets.GPG_PRIVATE_KEY }}
51+
signing-passphrase: ${{ secrets.GPG_PASSPHRASE }}
52+
artifact-properties: |
53+
/**/spring-graphql-docs-*.zip::zip.name=spring-graphql,zip.displayname=Spring for GraphQL,zip.type:docs,zip.deployed=false
54+
- name: Send notification
55+
uses: ./.github/actions/send-notification
56+
if: always()
57+
with:
58+
webhook-url: ${{ secrets.GOOGLE_CHAT_WEBHOOK_URL }}
59+
status: ${{ job.status }}
60+
build-scan-url: ${{ steps.build.outputs.build-scan-url }}
61+
run-name: ${{ format('{0} | Linux | Java 17', github.ref_name) }}

ci/pipeline.yml

Lines changed: 16 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -105,43 +105,6 @@ jobs:
105105
- put: ci-image
106106
params:
107107
image: ci-image/image.tar
108-
- name: build
109-
serial: true
110-
public: true
111-
plan:
112-
- get: ci-image
113-
- get: git-repo
114-
trigger: true
115-
- do:
116-
- task: build-project
117-
privileged: true
118-
timeout: ((task-timeout))
119-
image: ci-image
120-
file: git-repo/ci/tasks/build-project.yml
121-
params:
122-
BRANCH: ((branch))
123-
<<: *docker-hub-task-params
124-
<<: *gradle-enterprise-task-params
125-
- put: artifactory-repo
126-
params: &artifactory-params
127-
signing_key: ((signing-key))
128-
signing_passphrase: ((signing-passphrase))
129-
repo: libs-snapshot-local
130-
folder: distribution-repository
131-
build_uri: "https://ci.spring.io/teams/${BUILD_TEAM_NAME}/pipelines/${BUILD_PIPELINE_NAME}/jobs/${BUILD_JOB_NAME}/builds/${BUILD_NAME}"
132-
build_number: "${BUILD_PIPELINE_NAME}-${BUILD_JOB_NAME}-${BUILD_NAME}"
133-
disable_checksum_uploads: true
134-
threads: 8
135-
artifact_set:
136-
- include:
137-
- "/**/spring-graphql-docs-*.zip"
138-
properties:
139-
"zip.name": "spring-graphql"
140-
"zip.displayname": "Spring for GraphQL"
141-
"zip.deployed": "false"
142-
"zip.type": "docs"
143-
get_params:
144-
threads: 8
145108
- name: stage-milestone
146109
serial: true
147110
plan:
@@ -155,8 +118,22 @@ jobs:
155118
RELEASE_TYPE: M
156119
<<: *gradle-enterprise-task-params
157120
- put: artifactory-repo
158-
params:
159-
<<: *artifactory-params
121+
params: &artifactory-params
122+
signing_key: ((signing-key))
123+
signing_passphrase: ((signing-passphrase))
124+
folder: distribution-repository
125+
build_uri: "https://ci.spring.io/teams/${BUILD_TEAM_NAME}/pipelines/${BUILD_PIPELINE_NAME}/jobs/${BUILD_JOB_NAME}/builds/${BUILD_NAME}"
126+
build_number: "${BUILD_PIPELINE_NAME}-${BUILD_JOB_NAME}-${BUILD_NAME}"
127+
disable_checksum_uploads: true
128+
threads: 8
129+
artifact_set:
130+
- include:
131+
- "/**/spring-graphql-docs-*.zip"
132+
properties:
133+
"zip.name": "spring-graphql"
134+
"zip.displayname": "Spring for GraphQL"
135+
"zip.deployed": "false"
136+
"zip.type": "docs"
160137
repo: libs-staging-local
161138
- put: git-repo
162139
params:
@@ -307,8 +284,6 @@ jobs:
307284

308285

309286
groups:
310-
- name: "builds"
311-
jobs: ["build"]
312287
- name: "releases"
313288
jobs: [ "stage-milestone", "promote-milestone", "stage-rc", "promote-rc", "stage-release", "promote-release", "create-github-release" ]
314289
- name: "ci-images"

0 commit comments

Comments
 (0)