From ab86c3419ff7153a9161b6edb902b069fe0274f7 Mon Sep 17 00:00:00 2001 From: Andres Almiray Date: Mon, 29 Mar 2021 00:06:38 +0200 Subject: [PATCH] Update readme --- .gitignore | 4 +- README.adoc | 125 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 128 insertions(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index 85e7c1d..5d51d6c 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,3 @@ -/.idea/ +.idea/ +*.iml +.DS_Store diff --git a/README.adoc b/README.adoc index e69de29..3a9e659 100644 --- a/README.adoc +++ b/README.adoc @@ -0,0 +1,125 @@ += JReleaser +:linkattrs: +:project-owner: jreleaser +:project-name: github-action + +image:https://github.com/{project-owner}/{project-name}/workflows/Test/badge.svg["Build Status", link="https://github.com/{project-owner}/{project-name}/actions"] +image:https://img.shields.io/github/v/release/{project-owner}/{project-name}[GitHub release] +image:https://img.shields.io/twitter/follow/{project-owner}?style=social[Twitter Follow] + +This action executes a link:https://jreleaser.org[JReleaser] workflow. + +== Usage + +=== Workflow + +[source,yaml] +---- +name: release + +on: + workflow_dispatch: + +jobs: + release: + name: Release + runs-on: ubuntu-latest + + steps: + - name: Checkout + uses: actions/checkout@v2.3.4 + + # Configure build steps as you'd normally do + + - name: Setup Java + uses: actions/setup-java@v1.4.3 + with: + java-version: 1.8 + server-id: central + server-username: MAVEN_USERNAME + server-password: MAVEN_CENTRAL_TOKEN + gpg-private-key: ${{ secrets.GPG_PRIVATE_KEY }} + gpg-passphrase: MAVEN_GPG_PASSPHRASE + + # Post JARs to Maven Central + + - name: Release to Maven Central + env: + MAVEN_USERNAME: ${{ secrets.SONATYPE_USERNAME }} + MAVEN_CENTRAL_TOKEN: ${{ secrets.SONATYPE_PASSWORD }} + MAVEN_GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }} + run: | + export GPG_TTY=$(tty) + git config user.name "${{ github.event.head_commit.committer.name }}" + git config user.email "${{ github.event.head_commit.committer.email }}" + mvn -B --file pom.xml release:prepare release:perform + + # Create a release + + - name: Run JReleaser + uses: jreleaser/github-action@v1 + env: + JRELEASER_GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} +---- + +The last step executes a `full-release` with the default `jreleaser.yml` configuration that's expected +to be located at the root of the repository. + +== Customizing + +== Inputs + +Following inputs can be used as `step.with` keys + +[%header] +|=== +| Name | Type | Default | Description +| version | String | early-access | The JReleaser version to use. Should match any of the +link:https://github.com/jreleaser/jreleaser/releases[published releases]. +| arguments | String | full-release | The JReleaser command to run. +|=== + +== Environment Variables + +Following environment variables can be used as `step.env` keys + +[%header] +|=== +| Name | Description +| JRELEASER_GITHUB_TOKEN | link:https://help.github.com/en/actions/configuring-and-managing-workflows/authenticating-with-the-github_token[GITHUB_TOKEN] +as provided by `secrets` +|=== + +== Caution + +The default `GITHUB_TOKEN` from `secrets` is link:https://help.github.com/en/actions/configuring-and-managing-workflows/authenticating-with-the-github_token#about-the-github_token-secret[limited] +to the repository that contains your worklow. + +Pushing to other repositories such as Homebrew tap requires additional permissions, you must create a custom +link:https://help.github.com/articles/creating-a-personal-access-token-for-the-command-line/[Personal Access Token] with +`repo` permissions and link:https://help.github.com/en/actions/automating-your-workflow-with-github-actions/creating-and-using-encrypted-secrets[add it as a secret in the repository]. +If you create a secret named `GH_PAT`, the step will look like this + +[source,yaml] +---- + - name: Run JReleaser + uses: jreleaser/github-action@v1 + env: + JRELEASER_GITHUB_TOKEN: ${{ secrets.GH_PAT }} +---- + +If you'd rather have separate tokens for each additional repository and keep the original `GITHUB_TOKEN` intact then +you may apply the `GH_PAT` token as follows + +[source,yaml] +---- + - name: Run JReleaser + uses: jreleaser/github-action@v1 + env: + JRELEASER_GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + JRELEASER_HOMEBREW_GITHUB_TOKEN: ${{ secrets.GH_PAT }} +---- + +Additional environment variables may be needed depending on your specific setup. Review the docs at +link:https://jreleaser.org[]. +