Bump to 0.4.0-SNAPSHOT #83
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Java CI with Maven | |
on: | |
push: | |
branches: | |
- develop | |
- main | |
paths: | |
- src/** | |
- pom.xml | |
- .github/workflows/ci.yaml | |
pull_request_target: | |
branches: | |
- develop | |
- main | |
paths: | |
- src/** | |
- pom.xml | |
- .github/workflows/ci.yaml | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
permissions: | |
id-token: write | |
contents: read | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Import Secrets | |
id: secrets | |
uses: hashicorp/[email protected] | |
with: | |
exportToken: true | |
exportEnv: true | |
method: jwt | |
url: ${{ secrets.VAULT_ADDR }} | |
role: cicd | |
secrets: | | |
kv/data/cicd/sonatype username | SONATYPE_USERNAME ; | |
kv/data/cicd/sonatype password | SONATYPE_PASSWORD ; | |
kv/data/cicd/gpg secring | GPG_SECRING ; | |
kv/data/cicd/gpg passphrase | GPG_PASSPHRASE ; | |
- name: Set up JDK 17 | |
uses: actions/setup-java@v3 | |
with: | |
java-version: '17' | |
distribution: 'liberica' | |
cache: maven | |
gpg-private-key: ${{ steps.secrets.outputs.GPG_SECRING }} | |
gpg-passphrase: ${{ steps.secrets.outputs.GPG_PASSPHRASE }} | |
- name: Unit Tests for Spring 5 | |
run: | | |
set -e | |
sed -e 's/<artifactId>retryable-client-http-request-interceptor/<artifactId>retryable-client-http-request-interceptor-spring5/' -e 's/<java.version>17/<java.version>8/' -e 's/<spring-boot.version>3.1.5/<spring-boot.version>2.7.18/' pom.xml > pom-spring5.xml | |
./mvnw -f pom-spring5.xml -V --no-transfer-progress clean test | |
- name: Unit Tests for Spring 6 | |
run: | | |
set -e | |
./mvnw -V --no-transfer-progress clean test | |
- name: Deploy to sonatype-snapshots | |
if: github.ref == 'refs/heads/develop' | |
run: | | |
set -e | |
cat > settings.xml <<EOF | |
<settings> | |
<servers> | |
<server> | |
<id>sonatype-snapshots</id> | |
<username>${SONATYPE_USERNAME}</username> | |
<password>${SONATYPE_PASSWORD}</password> | |
</server> | |
</servers> | |
</settings> | |
EOF | |
CURRENT_VERSION=$(grep '<version>' pom.xml | head -n 1 | sed -e 's|<version>||g' -e 's|</version>||g' -e 's| ||g' | tr -d '\t') | |
if [ "${CURRENT_VERSION}" = "$(echo ${CURRENT_VERSION} | grep "\-SNAPSHOT")" ];then | |
./mvnw -f pom-spring5.xml -V clean deploy -s settings.xml --no-transfer-progress -DskipTests=true -DserverId=sonatype-snapshots | |
./mvnw -V clean deploy -s settings.xml --no-transfer-progress -DskipTests=true -DserverId=sonatype-snapshots | |
fi | |
- name: Deploy to sonatype-releases | |
if: github.ref == 'refs/heads/main' | |
run: | | |
cat > settings.xml <<EOF | |
<settings> | |
<servers> | |
<server> | |
<id>repo</id> | |
<username>${SONATYPE_USERNAME}</username> | |
<password>${SONATYPE_PASSWORD}</password> | |
</server> | |
</servers> | |
</settings> | |
EOF | |
mvn -f pom-spring5.xml\ | |
-V \ | |
clean \ | |
javadoc:jar \ | |
source:jar \ | |
package \ | |
org.apache.maven.plugins:maven-gpg-plugin:3.0.1:sign \ | |
org.sonatype.plugins:nexus-staging-maven-plugin:1.6.13:deploy \ | |
--no-transfer-progress \ | |
-s settings.xml \ | |
-DserverId=repo \ | |
-Dgpg.passphrase=${GPG_PASSPHRASE} \ | |
-DnexusUrl=https://oss.sonatype.org \ | |
-DautoReleaseAfterClose=true \ | |
-DaltDeploymentRepository=repo::default::https://oss.sonatype.org/service/local/staging/deploy/maven2 \ | |
-DskipTests=true \ | |
|| mvn -V \ | |
clean \ | |
javadoc:jar \ | |
source:jar \ | |
package \ | |
org.apache.maven.plugins:maven-gpg-plugin:3.0.1:sign \ | |
org.sonatype.plugins:nexus-staging-maven-plugin:1.6.13:deploy \ | |
--no-transfer-progress \ | |
-s settings.xml \ | |
-DserverId=repo \ | |
-Dgpg.passphrase=${GPG_PASSPHRASE} \ | |
-DnexusUrl=https://oss.sonatype.org \ | |
-DautoReleaseAfterClose=true \ | |
-DaltDeploymentRepository=repo::default::https://oss.sonatype.org/service/local/staging/deploy/maven2 \ | |
-DskipTests=true | |
- name: Revoke token | |
if: always() | |
run: | | |
curl -X POST -s -H "X-Vault-Token: ${VAULT_TOKEN}" ${{ secrets.VAULT_ADDR }}/v1/auth/token/revoke-self |