Skip to content

Commit

Permalink
Automate Publishing to Maven Central via CI (#29)
Browse files Browse the repository at this point in the history
* Adding Publish workflow

* Remove testing branch from Changesets workflow
  • Loading branch information
stigi authored Oct 11, 2024
1 parent dd302cb commit f7cfc63
Show file tree
Hide file tree
Showing 2 changed files with 58 additions and 3 deletions.
4 changes: 1 addition & 3 deletions .github/workflows/changeset.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
name: Changeset
on:
push:
branches:
- main
- ullrich/add-changesets
branches: [ "main" ]

concurrency: ${{ github.workflow }}-${{ github.ref }}

Expand Down
57 changes: 57 additions & 0 deletions .github/workflows/release-gradle-publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
name: Release Gradle Publish

on:
release:
types: [ created ]

jobs:
publish:
runs-on: ubuntu-latest
permissions:
contents: write

steps:
- uses: actions/checkout@v4

- name: Set up JDK 17
uses: actions/setup-java@v4
with:
java-version: '17'
distribution: 'temurin'

- name: Setup Gradle
uses: gradle/actions/setup-gradle@v4

- name: Setup Keyring
id: keyring
env:
KEYRING_FILE: ${{ runner.temp }}/publish-keyring.gpg
DATA: ${{ secrets.SIGNING_KEYRING }}
run: |
echo "Creating Keyring file at $KEYRING_FILE"
echo $DATA | base64 -di > $KEYRING_FILE
echo "keyringFile=$KEYRING_FILE" >> "$GITHUB_OUTPUT"
- name: Sanity Check
run: |
./gradlew \
sdk:lint sdk-compose:lint \
sdk:test sdk-compose:test
- name: Publish to Maven Local
run: |
./gradlew \
-Psigning.keyId="${{ secrets.SIGNING_KEYID }}" \
-Psigning.password="${{ secrets.SIGNING_PASSWORD }}" \
-Psigning.secretKeyRingFile="${{ steps.keyring.outputs.keyringFile }}" \
sdk:publishToMavenLocal sdk-compose:publishToMavenLocal
- name: Publish to Maven
run: |
./gradlew \
-Psigning.keyId="${{ secrets.SIGNING_KEYID }}" \
-Psigning.password="${{ secrets.SIGNING_PASSWORD }}" \
-Psigning.secretKeyRingFile="${{ steps.keyring.outputs.keyringFile }}" \
-PNEXUS_USERNAME="${{ secrets.NEXUS_USERNAME }}" \
-PNEXUS_PASSWORD="${{ secrets.NEXUS_PASSWORD }}" \
sdk:publish sdk-compose:publish

0 comments on commit f7cfc63

Please sign in to comment.