Setup workflow to upload to Maven central #2
Workflow file for this run
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: Release | |
on: | |
release: | |
types: | |
- created | |
pull_request: | |
jobs: | |
publish: | |
runs-on: ubuntu-latest | |
strategy: | |
fail-fast: true | |
matrix: | |
pkgs: ["inngest"] | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Setup Java | |
uses: actions/setup-java@v3 | |
with: | |
java-version: "8" | |
distribution: "temurin" | |
- name: Setup Gradle | |
uses: gradle/actions/setup-gradle@v3 | |
- name: Publish package | |
working-directory: ${{ matrix.pkgs }} | |
run: gradle publish --info | |
env: | |
MAVEN_USERNAME: ${{ secrets.MAVEN_USERNAME }} | |
MAVEN_PASSWORD: ${{ secrets.MAVEN_PASSWORD }} | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
GPG_SIGNING_KEY: ${{ secrets.GPG_SIGNING_KEY }} | |
GPG_SIGNING_KEY_PASSWORD: ${{ secrets.GPG_SIGNING_KEY_PASSWORD }} | |
- name: Create bundle for Maven Central | |
working-directory: ${{ matrix.pkgs }} | |
run: ./maven-bundle | |
- name: Upload bundle to Maven Central | |
working-directory: ${{ matrix.pkgs }} | |
run: | | |
# Generate bearer token | |
TOKEN=$(echo -n $AUTH | base64) | |
PKG_NAME=$NAME:$(cat VERSION) | |
# Upload via API | |
curl -v -X POST $PUBLISHER_API?name=$PKG_NAME&publishingType=USER_MANAGED -H "Authorization: Bearer $TOKEN" -F '[email protected]' | |
env: | |
AUTH: "${{ secrets.MAVEN_USERNAME }}:${{ secrets.MAVEN_PASSWORD }}" | |
NAME: com.inngest:inngest | |
PUBLISHER_API: https://central.sonatype.com/api/v1/publisher/upload |