Skip to content

Commit afbd929

Browse files
committed
Use GitHub actions for CI.
Closes gh-948
1 parent 14c377e commit afbd929

File tree

12 files changed

+136
-55
lines changed

12 files changed

+136
-55
lines changed

.github/workflows/ci.yml

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
name: CI Build
2+
3+
on:
4+
push:
5+
branches: [ main, 3.2.x, 3.1.x ]
6+
7+
permissions: read-all
8+
9+
jobs:
10+
build:
11+
name: Build project
12+
runs-on: ubuntu-latest
13+
steps:
14+
- uses: actions/checkout@v5
15+
- name: Set up Java
16+
uses: actions/setup-java@v5
17+
with:
18+
java-version: '25'
19+
distribution: temurin
20+
cache: maven
21+
- name: Cache Vault
22+
uses: actions/[email protected]
23+
with:
24+
path: |
25+
download
26+
vault
27+
key: ${{ runner.os }}-${{ hashFiles('src/test/bash/**') }}
28+
- name: Setup Vault
29+
run: src/test/bash/start.sh
30+
- name: Build
31+
run: ./mvnw -B -U clean verify
32+
- name: Deploy to Artifactory
33+
if: ${{ github.repository == 'spring-projects/spring-vault' }}
34+
env:
35+
ARTIFACTORY_USR: ${{ secrets.ARTIFACTORY_USERNAME }}
36+
ARTIFACTORY_PSW: ${{ secrets.ARTIFACTORY_PASSWORD }}
37+
BUILD_URL: "${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}"
38+
BUILD_NUMBER: "${{ github.run_number }}"
39+
run: ci/deploy-artifactory.sh

.github/workflows/docs-build.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
name: Deploy Docs Dispatch
2+
run-name: "${{ format('{0} Trigger', github.workflow) }}"
3+
24
on:
35
push:
46
branches-ignore: [ gh-pages ]

.github/workflows/release.yml

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
name: Release to Maven Central
2+
run-name: "${{ format('{0} for: {1}', github.workflow, github.event.head_commit.message) }}"
3+
4+
on:
5+
push:
6+
branches: [ release ]
7+
8+
permissions: read-all
9+
10+
jobs:
11+
build:
12+
name: Release project
13+
runs-on: ubuntu-latest
14+
if: ${{ github.repository == 'spring-projects/spring-vault' }}
15+
steps:
16+
- uses: actions/checkout@v5
17+
- name: Set up Java
18+
uses: actions/setup-java@v5
19+
with:
20+
java-version: '25'
21+
distribution: temurin
22+
cache: maven
23+
- name: Cache Vault
24+
uses: actions/[email protected]
25+
with:
26+
path: |
27+
download
28+
vault
29+
key: ${{ runner.os }}-${{ hashFiles('src/test/bash/**') }}
30+
- name: Install GPG key
31+
run: |
32+
echo "${{ secrets.GPG_PRIVATE_KEY }}" > gpg.asc
33+
echo "${{ secrets.GPG_PASSPHRASE }}" | gpg --batch --yes --passphrase-fd 0 --import gpg.asc
34+
- name: Release to Maven Central
35+
env:
36+
ARTIFACTORY_USR: ${{ secrets.ARTIFACTORY_USERNAME }}
37+
ARTIFACTORY_PSW: ${{ secrets.ARTIFACTORY_PASSWORD }}
38+
MAVEN_GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }}
39+
run: ci/release-to-maven-central.sh

Jenkinsfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ pipeline {
106106
RELEASE_TYPE = 'snapshot'
107107

108108
if (PROJECT_VERSION.matches(/.*-RC[0-9]+$/) || PROJECT_VERSION.matches(/.*-M[0-9]+$/)) {
109-
RELEASE_TYPE = "milestone"
109+
RELEASE_TYPE = "release"
110110
} else if (PROJECT_VERSION.endsWith('SNAPSHOT')) {
111111
RELEASE_TYPE = 'snapshot'
112112
} else if (PROJECT_VERSION.matches(/.*\.[0-9]+$/)) {

README.adoc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
= Spring Vault
1+
= Spring Vault link:https://github.com/spring-projects/spring-vault/actions/workflows/ci.yml[image:https://github.com/spring-projects/spring-vault/actions/workflows/ci.yml/badge.svg[CI Build]]
22

33
Spring Vault provides client-side support for accessing, storing and revoking secrets.
44
With https://www.vaultproject.io[HashiCorp's Vault] you have a central place to manage external secret data for applications across all environments.

ci/deploy-artifactory.sh

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
#!/bin/bash
2+
3+
#set -euo pipefail
4+
5+
PROJECT_VERSION=$(./ci/get-version.sh)
6+
7+
if [[ "$PROJECT_VERSION" == *SNAPSHOT ]]; then
8+
9+
echo "Deploying snapshot to Artifactory"
10+
./mvnw -s settings.xml -Pci,artifactory \
11+
-Dartifactory.server=https://repo.spring.io \
12+
-Dartifactory.username=${ARTIFACTORY_USR} \
13+
-Dartifactory.password=${ARTIFACTORY_PSW} \
14+
-Dartifactory.staging-repository=libs-snapshot-local \
15+
-Dartifactory.build-name=spring-vault \
16+
-Dartifactory.build-number=${BUILD_NUMBER} \
17+
-Dmaven.test.skip=true \
18+
clean deploy -U -B
19+
else
20+
echo "Skipping Artifactory deployment, not a snapshot version."
21+
fi
22+
23+

ci/deploy-maven-central.sh

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
#!/bin/bash
2+
3+
set -euo pipefail
4+
5+
./mvnw -s settings.xml -Pci,central,release \
6+
clean deploy -U -B

ci/deploy-milestone.sh

Lines changed: 0 additions & 22 deletions
This file was deleted.

ci/deploy-release.sh

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,4 @@ chmod -R go-rwx $GNUPGHOME
1111

1212
export MAVEN_GPG_PASSPHRASE="${PASSPHRASE}"
1313

14-
MAVEN_OPTS="-Duser.name=jenkins -Duser.home=/tmp/jenkins-home -Dmaven.repo.local=/tmp/jenkins-home/.m2/spring-vault" ./mvnw -s settings.xml -Pci,central,release \
15-
clean deploy -U -B
16-
17-
MAVEN_OPTS="-Duser.name=jenkins -Duser.home=/tmp/jenkins-home -Dmaven.repo.local=/tmp/jenkins-home/.m2/spring-vault" ./mvnw -s settings.xml -Pdistribute \
18-
-Dartifactory.server=https://repo.spring.io \
19-
-Dartifactory.username=${ARTIFACTORY_USR} \
20-
-Dartifactory.password=${ARTIFACTORY_PSW} \
21-
-Dartifactory.staging-repository=temp-private-local \
22-
clean deploy -U -B
14+
MAVEN_OPTS="-Duser.name=jenkins -Duser.home=/tmp/jenkins-home -Dmaven.repo.local=/tmp/jenkins-home/.m2/spring-vault" ./ci/deploy-maven-central.sh

ci/get-version.sh

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
#!/bin/bash
2+
3+
set -euo pipefail
4+
5+
RAW_VERSION=`./mvnw \
6+
org.apache.maven.plugins:maven-help-plugin:3.5.1:evaluate \
7+
-Dexpression=project.version -q -DforceStdout`
8+
9+
# Split things up
10+
VERSION_PARTS=($RAW_VERSION)
11+
12+
# Grab the last part, which is the actual version number.
13+
echo ${VERSION_PARTS[${#VERSION_PARTS[@]}-1]}

0 commit comments

Comments
 (0)