Gradle Package #15
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
| # This workflow will build a package using Gradle and then publish it to GitHub packages when a release is created | |
| # For more info see: https://github.com/actions/setup-java/blob/main/docs/advanced-usage.md#Publishing-using-gradle | |
| name: Gradle Package | |
| on: | |
| release: | |
| types: [created] | |
| workflow_dispatch: | |
| inputs: | |
| version: | |
| description: "Version to publish (e.g., v0.1.0)" | |
| required: true | |
| jobs: | |
| publish: | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: read | |
| packages: write | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Set up JDK 17 | |
| uses: actions/setup-java@v4 | |
| with: | |
| java-version: '17' | |
| distribution: 'temurin' | |
| server-id: github # Value of the distributionManagement/repository/id field of the pom.xml | |
| settings-path: ${{ github.workspace }} # location for the settings.xml file | |
| - name: Setup Gradle | |
| uses: gradle/actions/setup-gradle@v4 | |
| - name: Extract version from input or tag | |
| id: version | |
| shell: bash | |
| run: | | |
| VERSION="${{ inputs.version }}" | |
| if [[ -z "$VERSION" ]]; then | |
| VERSION="$GITHUB_REF_NAME" | |
| fi | |
| echo "version=${VERSION#v}" >> $GITHUB_OUTPUT | |
| - name: Build with Gradle | |
| working-directory: bindings/android | |
| run: ./gradlew build -Pversion=${{ steps.version.outputs.version }} | |
| # same credentials env vars used in the publishing section of build.gradle.kts | |
| - name: Publish to GitHub Packages | |
| working-directory: bindings/android | |
| env: | |
| GITHUB_ACTOR: ${{ github.actor }} | |
| GITHUB_TOKEN: ${{ secrets.ORG_PACKAGES_TOKEN }} | |
| GITHUB_REPO: ${{ github.repository }} | |
| run: ./gradlew publish -Pversion=${{ steps.version.outputs.version }} |