Merge pull request #19 from ButterCMS/release-please--branches--master #5
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
# This workflow will publish a package to the Apache Maven Central registry | |
name: Build & Publish | |
on: | |
push: | |
branches: [ master ] | |
jobs: | |
test: | |
if: contains(github.event.head_commit.message, 'chore(release)') | |
uses: './.github/workflows/test.yml' | |
build-and-deploy: | |
if: contains(github.event.head_commit.message, 'chore(release)') | |
runs-on: ubuntu-22.04 | |
needs: test | |
steps: | |
- name: Checkout code | |
uses: actions/[email protected] | |
- name: Set up JDK & Java | |
uses: actions/[email protected] | |
with: | |
java-version: '8' | |
distribution: 'adopt' | |
cache: 'maven' | |
cache-dependency-path: ./pom.xml | |
server-id: ossrh # This id should match with the id in your pom.xml or settings.xml | |
server-username: OSSRH_USERNAME # Env variable for username in deploy (Passes the environment variable name, not the value) | |
server-password: OSSRH_TOKEN # Env variable for token in deploy | |
gpg-private-key: ${{ secrets.GPG_PRIVATE_KEY }} # Value of the GPG private key to import | |
gpg-passphrase: GPG_PWD # Env variable for GPG private key passphrase | |
- name: Build with Maven Wrapper | |
run: ./mvnw clean install | |
- name: Deploy to Apache Maven | |
run: ./mvnw deploy -P release -Dgpg.skip=false # Using the profile `release` for using the necessary dependencies | |
env: | |
OSSRH_USERNAME: ${{ secrets.OSSRH_USERNAME }} | |
OSSRH_TOKEN: ${{ secrets.OSSRH_TOKEN }} | |
GPG_PWD: ${{ secrets.GPG_PWD }} |