0.0.13 #30
Workflow file for this run
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: publish | |
| permissions: | |
| contents: read | |
| on: | |
| release: | |
| types: [created] | |
| jobs: | |
| build: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v1 | |
| - uses: actions/setup-java@v4 | |
| with: | |
| distribution: 'adopt' | |
| java-version: '21' | |
| - name: Setup sbt launcher | |
| uses: sbt/setup-sbt@v1 | |
| - name: Extract version from release tag | |
| id: extract_version | |
| run: | | |
| version=$(echo "${GITHUB_REF#refs/tags/}") | |
| echo "VERSION=$version" >> $GITHUB_ENV | |
| - name: Update SBT version in build.sbt | |
| run: | | |
| sed -i "s/ThisBuild \/ version := .*/ThisBuild \/ version := \"$VERSION\"/" build.sbt | |
| - name: Compile | |
| run: sbt +compile | |
| - name: Import GPG key | |
| # Pin action to commit hash for security (v6.3.0) | |
| uses: crazy-max/ghaction-import-gpg@e89d40939c28e39f97cf32126055eeae86ba74ec | |
| with: | |
| gpg_private_key: ${{ secrets.PGP_SECRET }} | |
| passphrase: ${{ secrets.PGP_PASSPHRASE }} | |
| # Optional: Use if your key is not the default in the secret | |
| # key_id: ${{ secrets.PGP_KEY_ID }} | |
| - name: Publish to Central Portal | |
| id: publish_to_central | |
| env: | |
| SONATYPE_USERNAME: ${{ secrets.SONATYPE_USERNAME }} | |
| SONATYPE_PASSWORD: ${{ secrets.SONATYPE_PASSWORD }} | |
| # Provide passphrase to sbt-pgp | |
| PGP_PASSPHRASE: ${{ secrets.PGP_PASSPHRASE }} | |
| run: sbt +publishSigned | |
| - name: Ensure deployment visibility in Central Portal | |
| if: steps.publish_to_central.outcome == 'success' | |
| env: | |
| SONATYPE_USERNAME: ${{ secrets.SONATYPE_USERNAME }} | |
| SONATYPE_PASSWORD: ${{ secrets.SONATYPE_PASSWORD }} | |
| run: | | |
| # Base64 encode credentials for Bearer token authentication | |
| AUTH_TOKEN=$(echo -n "${SONATYPE_USERNAME}:${SONATYPE_PASSWORD}" | base64) | |
| # Make POST request to upload deployment to Central Publisher Portal | |
| curl -X POST \ | |
| -H "Authorization: Bearer ${AUTH_TOKEN}" \ | |
| -H "Content-Type: application/json" \ | |
| "https://ossrh-staging-api.central.sonatype.com/manual/upload/defaultRepository/io.github.unit-finance" |