Merge pull request #164 from Riskified/TIS-797 #87
This file contains 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: Maven CI/CD | |
on: | |
push: | |
branches: | |
- master | |
pull_request: | |
branches: | |
- master | |
workflow_dispatch: | |
jobs: | |
build_and_test: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checking out | |
uses: actions/checkout@v4 ##action to give our job access to code in our repo | |
- name: Cache local mvn repo | |
uses: actions/cache@v4 | |
with: | |
path: ~/.m2/repository | |
key: v1-dependencies-{{ hashFiles('**/pom.xml') }} | |
restore-keys: | | |
v1-dependencies- | |
- run: mvn dependency:go-offline | |
- name: Configuring GPG key | |
run: | | |
echo $GPG_SIGNING_KEY | base64 --decode | gpg --batch --import | |
env: | |
GPG_SIGNING_KEY: ${{ secrets.SECRING_GPG_ASC_BASE64 }} | |
- name: Set up JDK 8 | |
uses: actions/setup-java@v4 ##this action sets up a java environment that our job can run in | |
with: | |
distribution: 'zulu' | |
java-version: 8 | |
overwrite-settings: false | |
- name: Build project with Maven | |
run: mvn -B package --file pom.xml | |
- name: Publish to Apache Maven Central | |
if: github.event_name == 'push' && github.ref == 'refs/heads/master' | |
run: GPG_TTY=$(tty); mvn -s .github/workflows/maven-release-setting.xml clean deploy -DdeployAtEnd=true -DperformRelease=true -DskipTests -Dspotbugs.skip=true | |
env: | |
SERVER_OSSRH_USERNAME: ${{ secrets.SERVER_OSSRH_USERNAME }} | |
SERVER_OSSRH_PASSWORD: ${{ secrets.SERVER_OSSRH_PASSWORD }} | |
GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }} |