diff --git a/README.md b/README.md index d7b62a123..e846889d9 100644 --- a/README.md +++ b/README.md @@ -111,8 +111,8 @@ jobs: ## License -The scripts and documentation in this project are released under the [MIT License](LICENSE) +The scripts and documentation in this project are released under the [MIT License](LICENSE). ## Contributions -Contributions are welcome! See [Contributor's Guide](docs/contributors.md) +Contributions are welcome! See [Contributor's Guide](CONTRIBUTING.md) diff --git a/docs/advanced-usage.md b/docs/advanced-usage.md index 400505ead..6a2d1abe5 100644 --- a/docs/advanced-usage.md +++ b/docs/advanced-usage.md @@ -129,7 +129,6 @@ jobs: ```yaml jobs: build: - runs-on: ubuntu-latest steps: @@ -207,7 +206,7 @@ The two `settings.xml` files created from the above example look like the follow ``` -***NOTE***: The `settings.xml` file is created in the Actions $HOME/.m2 directory. If you have an existing `settings.xml` file at that location, it will be overwritten. See below for using the `settings-path` to change your `settings.xml` file location. +***NOTE***: The `settings.xml` file is created in the Actions `$HOME/.m2` directory. If you have an existing `settings.xml` file at that location, it will be overwritten. See [below](#apache-maven-with-a-settings-path) for using the `settings-path` to change your `settings.xml` file location. If you don't want to overwrite the `settings.xml` file, you can set `overwrite-settings: false` @@ -234,68 +233,67 @@ If `gpg-private-key` input is provided, the private key will be written to a fil See the help docs on [Publishing a Package](https://help.github.com/en/github/managing-packages-with-github-packages/configuring-apache-maven-for-use-with-github-packages#publishing-a-package) for more information on the `pom.xml` file. -## Publishing using Gradle +## Apache Maven with a settings path + +When using an Actions self-hosted runner with multiple shared runners the default `$HOME` directory can be shared by a number runners at the same time which could overwrite existing settings file. Setting the `settings-path` variable allows you to choose a unique location for your settings file. + ```yaml jobs: - build: runs-on: ubuntu-latest steps: - uses: actions/checkout@v2 - - - name: Set up JDK 11 + - name: Set up JDK 11 for Shared Runner uses: actions/setup-java@v2 with: distribution: '' java-version: '11' + 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: Build with Gradle - run: gradle build + - name: Build with Maven + run: mvn -B package --file pom.xml - - name: Publish to GitHub Packages - run: gradle publish + - name: Publish to GitHub Packages Apache Maven + run: mvn deploy -s $GITHUB_WORKSPACE/settings.xml env: - USERNAME: ${{ github.actor }} - PASSWORD: ${{ secrets.GITHUB_TOKEN }} + GITHUB_TOKEN: ${{ github.token }} ``` -***NOTE: The `USERNAME` and `PASSWORD` need to correspond to the credentials environment variables used in the publishing section of your `build.gradle`.*** - -See the help docs on [Publishing a Package with Gradle](https://help.github.com/en/github/managing-packages-with-github-packages/configuring-gradle-for-use-with-github-packages#example-using-gradle-groovy-for-a-single-package-in-a-repository) for more information on the `build.gradle` configuration file. - -## Apache Maven with a settings path - -When using an Actions self-hosted runner with multiple shared runners the default `$HOME` directory can be shared by a number runners at the same time which could overwrite existing settings file. Setting the `settings-path` variable allows you to choose a unique location for your settings file. - +## Publishing using Gradle ```yaml jobs: - build: + build: runs-on: ubuntu-latest steps: - uses: actions/checkout@v2 - - name: Set up JDK 11 for Shared Runner + + - name: Set up JDK 11 uses: actions/setup-java@v2 with: distribution: '' java-version: '11' - 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: Build with Maven - run: mvn -B package --file pom.xml + - name: Build with Gradle + run: gradle build - - name: Publish to GitHub Packages Apache Maven - run: mvn deploy -s $GITHUB_WORKSPACE/settings.xml + - name: Publish to GitHub Packages + run: gradle publish env: - GITHUB_TOKEN: ${{ github.token }} + USERNAME: ${{ github.actor }} + PASSWORD: ${{ secrets.GITHUB_TOKEN }} ``` +***NOTE: The `USERNAME` and `PASSWORD` need to correspond to the credentials environment variables used in the publishing section of your `build.gradle`.*** + +See the help docs on [Publishing a Package with Gradle](https://help.github.com/en/github/managing-packages-with-github-packages/configuring-gradle-for-use-with-github-packages#example-using-gradle-groovy-for-a-single-package-in-a-repository) for more information on the `build.gradle` configuration file. + ## Hosted Tool Cache -GitHub Hosted Runners have a tool cache that comes with some Java versions pre-installed. This tool cache helps speed up runs and tool setup by not requiring any new downloads. There is an environment variable called `RUNNER_TOOL_CACHE` on each runner that describes the location of this tools cache and this is where you can find the pre-installed versions of Java. `setup-java` works by taking a specific version of Java in this tool cache and adding it to PATH if the version, architecture and distribution match. +GitHub Hosted Runners have a tool cache that comes with some Java versions pre-installed. This tool cache helps speed up runs and tool setup by not requiring any new downloads. There is an environment variable called `RUNNER_TOOL_CACHE` on each runner that describes the location of this tools cache and this is where you can find the pre-installed versions of Java. `setup-java` works by taking a specific version of Java in this tool cache and adding it to PATH if the version, architecture and distribution match. Currently, LTS versions of Adopt OpenJDK (`adopt`) are cached on the GitHub Hosted Runners. -The tools cache gets updated on a weekly basis. For information regarding locally cached versions of Java on GitHub hosted runners, check out [GitHub Actions Virtual Environments](https://github.com/actions/virtual-environments). +The tools cache gets updated on a weekly basis. For information regarding locally cached versions of Java on GitHub hosted runners, check out [GitHub Actions Virtual Environments](https://github.com/actions/virtual-environments).