Skip to content

Publish

Publish #14

Workflow file for this run

name: Publish
on:
push:
tags:
- 'v*'
workflow_dispatch:
jobs:
test:
uses: ./.github/workflows/test.yml
publish:
needs: test
environment: production
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Setup JDK
uses: actions/setup-java@v3
with:
distribution: oracle
java-version: 17
- name: Configure GPG Key
env:
GPG_KEY: ${{ secrets.GPG_KEY }}
run: |
echo -n "$GPG_KEY" | base64 --decode | gpg --import
- name: Prepare environment
env:
SONATYPE_USERNAME: ${{ secrets.SONATYPE_USERNAME }}
SONATYPE_PASSWORD: ${{ secrets.SONATYPE_PASSWORD }}
run: |
mkdir -p ~/.sbt/1.0
touch ~/.sbt/1.0/sonatype.sbt
echo "credentials += Credentials(Path.userHome / \".sbt\" / \"sonatype_credentials\")" > ~/.sbt/1.0/sonatype.sbt
touch ~/.sbt/sonatype_credentials
echo "realm=Sonatype Nexus Repository Manager" > ~/.sbt/sonatype_credentials
echo "host=s01.oss.sonatype.org" >> ~/.sbt/sonatype_credentials
echo "user=$SONATYPE_USERNAME" >> ~/.sbt/sonatype_credentials
echo "password=$SONATYPE_PASSWORD" >> ~/.sbt/sonatype_credentials
mkdir ~/.sbt/1.0/plugins
touch ~/.sbt/1.0/plugins/gpg.sbt
echo "addSbtPlugin(\"com.github.sbt\" % \"sbt-pgp\" % \"2.1.2\")" > ~/.sbt/1.0/plugins/gpg.sbt
- name: Deploy
run: sbt publishSigned
- name: Message
run: echo "Staging repository created at https://s01.oss.sonatype.org/#stagingRepositories"