diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 0000000..d73ce7a --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,65 @@ +name: Build + +on: + # Only run on push to main branch + push: + branches: + - main + # Always run on PRs + pull_request: + +jobs: + build: + name: Build and Test + runs-on: 'macos-latest' + timeout-minutes: 60 + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Gradle Wrapper Validation + uses: gradle/actions/wrapper-validation@v4 + + - name: Install JDK 11 + uses: actions/setup-java@v4 + with: + distribution: 'zulu' + java-version: 11 + + - name: Setup Gradle + uses: gradle/actions/setup-gradle@v4 + + - name: Build with Gradle + run: ./gradlew build + + publish: + if: github.repository == 'sproctor/compose-data-table' && github.ref == 'refs/heads/main' && github.event_name != 'pull_request' + needs: [build] + runs-on: macos-latest + timeout-minutes: 60 + + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Gradle Wrapper Validation + uses: gradle/actions/wrapper-validation@v4 + + - name: Install JDK 11 + uses: actions/setup-java@v4 + with: + distribution: 'zulu' + java-version: 11 + + - name: Setup Gradle + uses: gradle/actions/setup-gradle@v4 + + - name: Publish release + run: ./gradlew publish --no-configuration-cache + if: success() + env: + ORG_GRADLE_PROJECT_mavenCentralUsername: ${{ secrets.MAVEN_CENTRAL_USERNAME }} + ORG_GRADLE_PROJECT_mavenCentralPassword: ${{ secrets.MAVEN_CENTRAL_PASSWORD }} + ORG_GRADLE_PROJECT_signingInMemoryKey: ${{ secrets.GPG_KEY }} + ORG_GRADLE_PROJECT_signingInMemoryKeyId: ${{ secrets.GPG_KEY_ID }} + ORG_GRADLE_PROJECT_signingInMemoryKeyPassword: ${{ secrets.GPG_KEY_PASSWORD }} \ No newline at end of file