name: Publish to GitHub Packages

on:
  # Publishes packages on release (the Rhino version should not be
  # changed to '-SNAPSHOT' before creating the release in Github).
  release:
    types: [published]
  # Allows to run this workflow manually from the Actions tab
  workflow_dispatch:
jobs:
  build:
    runs-on: ubuntu-latest
    permissions:
      contents: read
      packages: write
    steps:
    - name: Checkout
      uses: actions/checkout@v2
    - name: Set up JDK
      uses: actions/setup-java@v2
      with:
        java-version: '8'
        distribution: 'adopt'
        server-id: github
        settings-path: ${{ github.workspace }}
    - name: Publish
      env:
        ORG_GRADLE_PROJECT_SIGNINGKEY: ${{ secrets.ORG_GRADLE_PROJECT_SIGNINGKEY }}
        ORG_GRADLE_PROJECT_SIGNINGPASSWORD: ${{ secrets.ORG_GRADLE_PROJECT_SIGNINGPASSWORD }}
      run: >-
        ./gradlew publish
        -PmavenReleaseRepo="https://maven.pkg.github.com/mozilla/rhino"
        -PmavenSnapshotRepo="https://maven.pkg.github.com/mozilla/rhino"
        -PmavenUser=${{ github.actor }}
        -PmavenPassword=${{ secrets.GITHUB_TOKEN }}

Add workflow to publish to GitHub packages
Add workflow to publish to GitHub packages
