mirror of
https://github.com/gradle/gradle-build-action.git
synced 2024-12-01 12:41:02 -05:00
parent
0206df026c
commit
01bfa29846
5 changed files with 18 additions and 21 deletions
26
README.md
26
README.md
|
@ -1,12 +1,10 @@
|
||||||
# Execute Gradle commands in GitHub Actions workflows
|
# Execute Gradle builds in GitHub Actions workflows
|
||||||
|
|
||||||
This GitHub Action can be used to run arbitrary Gradle commands on any platform supported by GitHub Actions.
|
This GitHub Action can be used to execute a Gradle build on any platform supported by GitHub Actions.
|
||||||
|
|
||||||
You might also be interested by the related [Gradle Plugin](https://github.com/eskatos/gradle-github-actions-plugin) that allows your build to easily get GitHub Actions environment and tag Gradle Build Scans accordingly.
|
|
||||||
|
|
||||||
## Usage
|
## Usage
|
||||||
|
|
||||||
The following workflow will run `./gradlew build` using the wrapper from the repository on ubuntu, macos and windows. The only prerequisite is to have Java installed, you can define the version you need to run the build using the `actions/setup-java` action.
|
The following workflow will run `./gradlew build` using the wrapper from the repository on ubuntu, macos and windows. The only prerequisite is to have Java installed: you define the version of Java you need to run the build using the `actions/setup-java` action.
|
||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
# .github/workflows/gradle-build-pr.yml
|
# .github/workflows/gradle-build-pr.yml
|
||||||
|
@ -23,7 +21,7 @@ jobs:
|
||||||
- uses: actions/setup-java@v1
|
- uses: actions/setup-java@v1
|
||||||
with:
|
with:
|
||||||
java-version: 11
|
java-version: 11
|
||||||
- uses: eskatos/gradle-command-action@v1
|
- uses: gradle/gradle-build-action@v1
|
||||||
with:
|
with:
|
||||||
arguments: build
|
arguments: build
|
||||||
```
|
```
|
||||||
|
@ -47,7 +45,7 @@ See `gradle --help` for more information.
|
||||||
If you need to pass environment variables, simply use the GitHub Actions workflow syntax:
|
If you need to pass environment variables, simply use the GitHub Actions workflow syntax:
|
||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
- uses: eskatos/gradle-command-action@v1
|
- uses: gradle/gradle-build-action@v1
|
||||||
env:
|
env:
|
||||||
CI: true
|
CI: true
|
||||||
```
|
```
|
||||||
|
@ -55,7 +53,7 @@ If you need to pass environment variables, simply use the GitHub Actions workflo
|
||||||
## Run a build from a different directory
|
## Run a build from a different directory
|
||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
- uses: eskatos/gradle-command-action@v1
|
- uses: gradle/gradle-build-action@v1
|
||||||
with:
|
with:
|
||||||
build-root-directory: some/subdirectory
|
build-root-directory: some/subdirectory
|
||||||
```
|
```
|
||||||
|
@ -63,7 +61,7 @@ If you need to pass environment variables, simply use the GitHub Actions workflo
|
||||||
## Use a specific `gradle` executable
|
## Use a specific `gradle` executable
|
||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
- uses: eskatos/gradle-command-action@v1
|
- uses: gradle/gradle-build-action@v1
|
||||||
with:
|
with:
|
||||||
gradle-executable: path/to/gradle
|
gradle-executable: path/to/gradle
|
||||||
```
|
```
|
||||||
|
@ -71,7 +69,7 @@ If you need to pass environment variables, simply use the GitHub Actions workflo
|
||||||
## Use a Gradle wrapper from a different directory
|
## Use a Gradle wrapper from a different directory
|
||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
- uses: eskatos/gradle-command-action@v1
|
- uses: gradle/gradle-build-action@v1
|
||||||
with:
|
with:
|
||||||
gradle-executable: path/to/gradlew
|
gradle-executable: path/to/gradlew
|
||||||
```
|
```
|
||||||
|
@ -81,7 +79,7 @@ If you need to pass environment variables, simply use the GitHub Actions workflo
|
||||||
## Setup and use a declared Gradle version
|
## Setup and use a declared Gradle version
|
||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
- uses: eskatos/gradle-command-action@v1
|
- uses: gradle/gradle-build-action@v1
|
||||||
with:
|
with:
|
||||||
gradle-version: 6.5
|
gradle-version: 6.5
|
||||||
```
|
```
|
||||||
|
@ -114,7 +112,7 @@ jobs:
|
||||||
- uses: actions/setup-java@v1
|
- uses: actions/setup-java@v1
|
||||||
with:
|
with:
|
||||||
java-version: 11
|
java-version: 11
|
||||||
- uses: eskatos/gradle-command-action@v1
|
- uses: gradle/gradle-build-action@v1
|
||||||
with:
|
with:
|
||||||
gradle-version: release-candidate
|
gradle-version: release-candidate
|
||||||
arguments: build --dry-run # just test build configuration
|
arguments: build --dry-run # just test build configuration
|
||||||
|
@ -189,7 +187,7 @@ dependencies-cache-exact: true
|
||||||
|
|
||||||
## Build scans
|
## Build scans
|
||||||
|
|
||||||
If your build publishes a [build scan](https://gradle.com/build-scans/) the `gradle-command-action` action will emit the link to the published build scan as an output named `build-scan-url`.
|
If your build publishes a [build scan](https://gradle.com/build-scans/) the `gradle-build-action` action will emit the link to the published build scan as an output named `build-scan-url`.
|
||||||
|
|
||||||
You can then use that link in subsequent actions of your workflow.
|
You can then use that link in subsequent actions of your workflow.
|
||||||
|
|
||||||
|
@ -210,7 +208,7 @@ jobs:
|
||||||
- uses: actions/setup-java@v1
|
- uses: actions/setup-java@v1
|
||||||
with:
|
with:
|
||||||
java-version: 11
|
java-version: 11
|
||||||
- uses: eskatos/gradle-command-action@v1
|
- uses: gradle/gradle-build-action@v1
|
||||||
with:
|
with:
|
||||||
arguments: build
|
arguments: build
|
||||||
id: gradle
|
id: gradle
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
name: "Gradle Command"
|
name: "Gradle Command"
|
||||||
description: 'Execute Gradle Command Line'
|
description: 'Execute Gradle Build'
|
||||||
author: 'Paul Merlin <paul@nospere.org>'
|
|
||||||
|
|
||||||
# https://help.github.com/en/articles/metadata-syntax-for-github-actions
|
# https://help.github.com/en/articles/metadata-syntax-for-github-actions
|
||||||
|
|
||||||
|
|
2
package-lock.json
generated
2
package-lock.json
generated
|
@ -1,5 +1,5 @@
|
||||||
{
|
{
|
||||||
"name": "gradle-command-action",
|
"name": "gradle-build-action",
|
||||||
"version": "1.0.0",
|
"version": "1.0.0",
|
||||||
"lockfileVersion": 1,
|
"lockfileVersion": 1,
|
||||||
"requires": true,
|
"requires": true,
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
{
|
{
|
||||||
"name": "gradle-command-action",
|
"name": "gradle-build-action",
|
||||||
"version": "1.0.0",
|
"version": "1.0.0",
|
||||||
"private": true,
|
"private": true,
|
||||||
"description": "Execute Gradle Command Line",
|
"description": "Execute Gradle Build",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"format": "prettier --write **/*.ts",
|
"format": "prettier --write **/*.ts",
|
||||||
"format-check": "prettier --check **/*.ts",
|
"format-check": "prettier --check **/*.ts",
|
||||||
|
@ -13,7 +13,7 @@
|
||||||
},
|
},
|
||||||
"repository": {
|
"repository": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
"url": "git+https://github.com/eskatos/gradle-command-action.git"
|
"url": "git+https://github.com/gradle/gradle-build-action.git"
|
||||||
},
|
},
|
||||||
"keywords": [
|
"keywords": [
|
||||||
"github",
|
"github",
|
||||||
|
|
|
@ -178,7 +178,7 @@ async function httpGetGradleVersions(
|
||||||
}
|
}
|
||||||
|
|
||||||
async function httpGetString(url: string): Promise<string> {
|
async function httpGetString(url: string): Promise<string> {
|
||||||
const httpClient = new httpm.HttpClient('eskatos/gradle-command-action')
|
const httpClient = new httpm.HttpClient('gradle/gradle-build-action')
|
||||||
const response = await httpClient.get(url)
|
const response = await httpClient.get(url)
|
||||||
return response.readBody()
|
return response.readBody()
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue