Skip to content

Publish

Publish #13

Workflow file for this run

name: Publish
on: workflow_dispatch
jobs:
main:
runs-on: ubuntu-latest
permissions: write-all
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Get Release Name
shell: python
run: |
import os
#ref = os.environ['GITHUB_REF']
#name = ref[ref.rfind('/') + 1:]
with open('VERSION', 'r') as verFile:
name = verFile.read().strip()
with open(os.environ['GITHUB_ENV'], 'w') as env:
print('RELEASE_NAME=' + name, file=env)
- name: Bundle Code
working-directory: ${{github.workspace}}/jnigen
shell: bash
run: ./gradlew -PbuildDir=build bundleCpp bundleJava
- name: Publish to OSSRH
env:
GPG_KEY: ${{ secrets.GPG_KEY }}
GPG_KEY_ID: ${{ secrets.GPG_KEY_ID }}
GPG_KEY_PASSWD: ${{ secrets.GPG_KEY_PASSWD }}
OSSRH_USERNAME: ${{ secrets.OSSRH_USERNAME }}
OSSRH_PASSWORD: ${{ secrets.OSSRH_PASSWORD }}
working-directory: ${{github.workspace}}/jnigen
shell: bash
run: |
echo $GPG_KEY | base64 --decode | gpg --import --batch --pinentry-mode=loopback
gpg --batch --pinentry-mode=loopback --keyring secring.gpg --export-secret-keys --passphrase "$GPG_KEY_PASSWD" > $HOME/.gnupg/secring.gpg
./gradlew -PbuildDir=build \
-Psigning.keyId=$GPG_KEY_ID \
-Psigning.password=$GPG_KEY_PASSWD \
-Psigning.secretKeyRingFile=$HOME/.gnupg/secring.gpg \
-PossrhUsername=$OSSRH_USERNAME \
-PossrhPassword=$OSSRH_PASSWORD \
publishAllPublicationsToOssrhRepository
- name: Make release
uses: softprops/action-gh-release@v2
with:
draft: true
prerelease: false
name: ${{ env.RELEASE_NAME }}
body: ...edit me...
files: |
jnigen/build/SimpleJNI-${{ env.RELEASE_NAME }}-cpp-only.zip
jnigen/build/SimpleJNI-${{ env.RELEASE_NAME }}-jnigen.zip