Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Support Gradle tasks #65

Merged
merged 1 commit into from
Jul 13, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions .github/workflows/cmd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,10 @@ on:
type: boolean
required: false
default: false
gradle-build-root:
type: string
required: false
default: ""

jobs:
prepare-matrix:
Expand Down Expand Up @@ -99,6 +103,15 @@ jobs:
id: coursier-cache
uses: coursier/cache-action@v6

- name: Gradle Cache
uses: burrunan/gradle-cache-action@v1
with:
build-root-directory: ${{ inputs.gradle-build-root }}
# Disable caching of ~/.gradle/caches/build-cache-*
save-local-build-cache: false
# Disable caching of ~/.m2/repository/
save-maven-dependencies-cache: false
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just checking

  • save-generated-gradle-jars: false and
  • save-gradle-dependencies-cache: false

are not needed? I guess you know what you are doing, just double checking :)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, I think the default values of these parameters are OK for us 😉


- name: Custom Cache
uses: actions/cache@v3
if: ${{ inputs.cache-key != '' && inputs.cache-path != '' }}
Expand Down
24 changes: 24 additions & 0 deletions .github/workflows/gradle-wrapper-validation.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
name: Gradle Wrapper Validation

on:
workflow_call:
inputs:
ref:
type: string
required: false
default: ''

jobs:
cmd:
name: Gradle Wrapper Validation
runs-on: ubuntu-20.04
steps:
- name: Checkout
uses: actions/checkout@v3
with:
# we don't know what commit the last tag was it's safer to get entire repo so previousStableVersion resolves
fetch-depth: 0
ref: ${{ inputs.ref }}

- name: Gradle Wrapper Validation
uses: gradle/wrapper-validation-action@v1
24 changes: 23 additions & 1 deletion .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,14 @@ on:
type: string
required: false
default: 11
cmd:
type: string
required: false
default: "sbt ci-release"
gradle-build-root:
type: string
required: false
default: ""

jobs:
cmd:
Expand All @@ -29,18 +37,32 @@ jobs:
id: coursier-cache
uses: coursier/cache-action@v6

- name: Gradle Cache
uses: burrunan/gradle-cache-action@v1
with:
build-root-directory: ${{ inputs.gradle-build-root }}
# Disable caching of ~/.gradle/caches/build-cache-*
save-local-build-cache: false
# Disable caching of ~/.m2/repository/
save-maven-dependencies-cache: false

- name: Install Adoptium Temurin OpenJDK
uses: coursier/setup-action@v1
with:
jvm: adoptium:${{ inputs.java }}

- name: Publish artifacts
run: sbt ci-release
run: ${{ inputs.cmd }}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I like that, I think I already could have used that in the past.

env:
# Credentials for publishing to Sonatype https://github.com/sbt/sbt-ci-release#secrets
SONATYPE_USERNAME: ${{ secrets.SONATYPE_USERNAME }}
SONATYPE_PASSWORD: ${{ secrets.SONATYPE_PASSWORD }}
# Keys for signing https://github.com/sbt/sbt-ci-release#secrets
PGP_PASSPHRASE: ${{ secrets.PGP_PASSPHRASE }}
PGP_SECRET: ${{ secrets.PGP_SECRET }}
# Gradle Plugin Portal API Keys https://docs.gradle.org/current/userguide/publishing_gradle_plugins.html
GRADLE_PUBLISH_KEY: ${{ secrets.GRADLE_PUBLISH_KEY }}
GRADLE_PUBLISH_SECRET: ${{ secrets.GRADLE_PUBLISH_SECRET }}

- name: Cleanup before cache
shell: bash
Expand Down
37 changes: 32 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ This repository contains a few configurations of GitHub features. For example a
* [Universal CMD task](#universal-cmd-task)
* [Publishing to Sonatype](#publishing-to-sonatype)
* [Validate Binary Compatibility](#validate-binary-compatibility)
* [Validate Gradle Wrapper](#validate-gradle-wrapper)
* [Mark Pull Request as Ready To Merge](#mark-pull-request-as-ready-to-merge)
* [Generate documentation with Antora](#generate-documentation-with-antora)

Expand Down Expand Up @@ -53,6 +54,7 @@ Every matrix dimension will be access by environment variable like `MATRIX_$(upp
| cache-path | 2.0.0 | :heavy_minus_sign: | '' | Path of custom cache |
| env | 2.0.0 | :heavy_minus_sign: | '' | Custom ENV vars |
| run-scheduled-in-forks | 3.1.1 | :heavy_minus_sign: | false | Run by schedule in fork |
| gradle-build-root | 3.3.0 | :heavy_minus_sign: | '' | Directory for Gradle builds |


**How to use**:
Expand All @@ -73,7 +75,7 @@ with:

### Publishing to Sonatype

This workflow is used for publishing snapshots artifacts to [Sonatype Snapshots](https://oss.sonatype.org/content/repositories/snapshots/com/typesafe/play/) repository or release artifacts to [Maven Central](https://repo1.maven.org/maven2/com/typesafe/play/).
This workflow is used for publishing snapshots artifacts to [Sonatype Snapshots](https://oss.sonatype.org/content/repositories/snapshots/com/typesafe/play/) repository or release artifacts to [Maven Central](https://repo1.maven.org/maven2/com/typesafe/play/).

:warning: For using this workflow project must uses the [CI Release](https://github.com/sbt/sbt-ci-release) plugin.

Expand All @@ -87,10 +89,12 @@ This workflow is used for publishing snapshots artifacts to [Sonatype Snapshots]

**Parameters**:

| Parameter | Since | Required | Default | Description |
|-----------|-------|--------------------|---------|------------------------------------|
| ref | 2.0.0 | :heavy_minus_sign: | '' | Branch, tag or SHA for checkout |
| java | 1.0.0 | :heavy_minus_sign: | 11 | _AdoptJDK_ version |
| Parameter | Since | Required | Default | Description |
|-------------------|-------|--------------------|----------------|---------------------------------|
| ref | 2.0.0 | :heavy_minus_sign: | '' | Branch, tag or SHA for checkout |
| java | 1.0.0 | :heavy_minus_sign: | 11 | _AdoptJDK_ version |
| cmd | 3.3.0 | :heavy_minus_sign: | sbt ci-release | Running command |
| gradle-build-root | 3.3.0 | :heavy_minus_sign: | '' | Directory for Gradle builds |

**How to use**:

Expand Down Expand Up @@ -126,6 +130,29 @@ This workflow is used for validate binary compatibility the current version.
uses: playframework/.github/.github/workflows/binary-check.yml@v3
```

### Validate Gradle Wrapper

This workflow is used to validate the checksums of [Gradle Wrapper](https://docs.gradle.org/current/userguide/gradle_wrapper.html) JAR files present in the source tree and fails if unknown Gradle Wrapper JAR files are found.

**Path**: [`.github/workflows/gradle-wrapper-validation.yml`](.github/workflows/gradle-wrapper-validation.yml)

**Image**: [Ubuntu 20.04](https://github.com/actions/runner-images/blob/main/images/linux/Ubuntu2004-Readme.md)

**Uses actions**:
* [Gradle/Wrapper Validation Action](https://github.com/gradle/wrapper-validation-action)

**Parameters**:

| Parameter | Since | Required | Default | Description |
|------------------------|-------|--------------------|---------|---------------------------------|
| ref | 3.3.0 | :heavy_minus_sign: | '' | Branch, tag or SHA for checkout |

**How to use**:

```yaml
uses: playframework/.github/.github/workflows/gradle-wrapper-validation.yml@v3
```

### Mark Pull Request as Ready To Merge

This workflow is used for mark pull request as ready to merge and **should be last** in the workflows chain.
Expand Down