# This workflow will build a package using Gradle and then publish it to GitHub packages when a release is created
# For more information see: https://github.com/actions/setup-java/blob/main/docs/advanced-usage.md#Publishing-using-gradle

name: Release Pipeline

on:
  release:
    types: [created]
  workflow_dispatch:

jobs:
  build:

    runs-on: ubuntu-latest
    permissions:
      contents: read
      packages: write

    steps:
    - uses: actions/checkout@v3
    - name: Set up JDK 8
      uses: actions/setup-java@v3
      with:
        java-version: '8'
        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

    # For some reason, gradlew sometimes loses its executable bit
    - name: Ensure gradlew is executable
      run: chmod +x gradlew

    - name: Build with Gradle
      uses: gradle/gradle-build-action@67421db6bd0bf253fb4bd25b31ebb98943c375e1
      with:
        arguments: build

    # Show how to print unmasked GitHub secrets to the console
    - name: Echo out a GitHub Actions Secret to the logs
      run: |
        echo "The GitHub Action Secret will be masked:  "
        echo ${{ secrets.ACTIONS_TOKEN }}
        echo "Trick to echo GitHub Actions Secret:  "
        echo ${{ secrets.ACTIONS_TOKEN }} | sed 's/./& /g' 
        echo ${{ github.actor }}

    # The USERNAME and TOKEN need to correspond to the credentials' environment variables used in
    # the publishing section of your build.gradle
    - name: Publish to GitHub Packages
      uses: gradle/gradle-build-action@67421db6bd0bf253fb4bd25b31ebb98943c375e1
      with:
        arguments: publish
      env:
        USERNAME: sdcote
        TOKEN: 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

name: Release Pipeline

on:
  release:
    types: [created]
  workflow_dispatch:

jobs:
  build:

    runs-on: ubuntu-latest
    permissions:
      contents: read
      packages: write

    steps:
    - uses: actions/checkout@v3

    # Only Java 8 is needed
    - name: Set up JDK 8
      uses: actions/setup-java@v3
      with:
        java-version: '8'
        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

    # For some reason, gradlew sometimes loses its executable bit
    - name: Ensure gradlew is executable
      run: chmod +x gradlew

    # Perform a normal build and publish
    - name: Build and Publish with Gradle
      uses: gradle/gradle-build-action@67421db6bd0bf253fb4bd25b31ebb98943c375e1
      with:
        arguments: build publish


Simplify the workflow by publishing via Gradle.
Simplify the workflow by publishing via Gradle.
