GitHub Actions
Set up JFrog CLI in GitHub Actions to publish build information to Artifactory.
The Setup JFrog CLI action installs and configures JFrog CLI for a GitHub Actions job. Use it to resolve and publish packages through JFrog Artifactory and attach artifacts, dependencies, environment data, and Git metadata to build information.
Note
Use
jfrog/setup-jfrog-cli@v4for new GitHub Actions workflows. Start with an access token for the shortest setup, or use OpenID Connect (OIDC) to avoid a long-lived JFrog secret.
This topic covers the following tasks:
Prerequisites
- A GitHub repository where you can add a workflow and repository secrets or variables.
- A JFrog Platform URL stored as the non-secret GitHub variable
JF_URL. - One authentication method:
- An access token stored as
JF_ACCESS_TOKEN. JF_USERandJF_PASSWORD.- A JFrog OIDC integration and identity mapping.
- An access token stored as
- Artifactory repositories and permissions required by the package command you plan to run, including deploy and publish-build-info.
- One build name and number for collect, upload, and publish. The action can set these values for you.
Before You Begin
Use a repository whose package type matches the jf command. For the integration layers and identity rules, see . For definitions of terms such as OIDC and access token, see the .
Quick Start
To set up JFrog CLI in a GitHub Actions workflow:
Create .github/workflows/jfrog.yml:
name: JFrog build
on:
push:
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up JFrog CLI
uses: jfrog/setup-jfrog-cli@v4
env:
JF_URL: ${{ vars.JF_URL }}
JF_ACCESS_TOKEN: ${{ secrets.JF_ACCESS_TOKEN }}
- name: Verify the connection
run: jf rt pingCommit and push the workflow. A successful verification step prints:
OKThe action also sets JFROG_CLI_BUILD_NAME and JFROG_CLI_BUILD_NUMBER from the workflow name and run number. JFrog CLI package operations can therefore contribute to one build without repeating these values on every command.
What You Should See Next
To confirm that the action is working:
- Open the GitHub workflow run and confirm that Verify the connection succeeded.
- After you add build commands, review the JFrog Job Summary in the workflow run.
- In the JFrog Platform UI, open Builds and select the workflow build name and run number.
The action automatically publishes collected build-info at the end of a successful workflow unless you manually publish it or set disable-auto-build-publish: true.
Use OIDC Instead of a Stored Token
OIDC requires a matching integration and identity mapping in JFrog. The workflow must be allowed to request a GitHub ID token.
To authenticate with OIDC:
permissions:
id-token: write
contents: read
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: jfrog/setup-jfrog-cli@v4
env:
JF_URL: ${{ vars.JF_URL }}
with:
oidc-provider-name: setup-jfrog-cli
- run: jf rt pingoidc-provider-name must exactly match the Provider Name in the JFrog OIDC integration. oidc-audience is optional. The action exposes oidc-token and oidc-user outputs when OIDC succeeds. Treat the token as sensitive.
Publish Package Build Information
To publish build information:
Run a package command through JFrog CLI. For example, after configuring Maven repositories:
- name: Build with Maven
run: jf mvn clean deployThe action's post step publishes pending build-info automatically.
To control publication yourself:
- uses: jfrog/setup-jfrog-cli@v4
with:
disable-auto-build-publish: true
env:
JF_URL: ${{ vars.JF_URL }}
JF_ACCESS_TOKEN: ${{ secrets.JF_ACCESS_TOKEN }}
- run: |
jf rt bce
jf rt bag
jf rt bpbce collects environment data, bag adds Git metadata, and bp publishes the build. Keep the default secret-exclusion patterns. For more information about the record these commands publish, see .
Configuration Reference
The action accepts the following inputs.
| Input | Default | Purpose |
|---|---|---|
version | 2.91.0 in the verified descriptor | JFrog CLI version. Use a deliberate pin for reproducibility |
download-repository | — | Artifactory remote repository used to download CLI |
oidc-provider-name | — | JFrog OIDC provider name |
oidc-audience | repository-owner URL | OIDC audience |
disable-job-summary | false | Disable the GitHub Job Summary |
disable-auto-build-publish | false | Disable post-step build publication |
disable-auto-evidence-collection | false | Disable automatic evidence collection |
custom-server-id | generated per run | Override the action's CLI server ID |
enable-package-alias | false | Install native package-manager aliases |
package-alias-tools | all supported tools | Comma-separated aliases to install |
The action runs on Node 24.
Package Aliases
Package aliases let later steps use native commands such as mvn, npm, and go while routing them through JFrog CLI:
- uses: jfrog/setup-jfrog-cli@v4
with:
version: latest
enable-package-alias: true
package-alias-tools: npm,mvn,go
env:
JF_URL: ${{ vars.JF_URL }}
JF_ACCESS_TOKEN: ${{ secrets.JF_ACCESS_TOKEN }}This feature requires JFrog CLI 2.93.0 or later. If alias installation fails, the action warns but does not fail the job. Subsequent native commands then run without the alias.
CI Notes
- Store
JF_URLas a GitHub variable so Job Summary links are not masked. - Store tokens and passwords as secrets.
- Pin the action to
@v4, and optionally pin the CLIversion. - If a build tool is installed after this action, ensure the package-alias directory remains first in
PATH. - For an isolated network, set
download-repositoryto an Artifactory remote repository that proxies JFrog CLI releases.
Troubleshooting
The following table lists common problems and their resolutions.
| Problem | Resolution |
|---|---|
jf rt ping returns 401 after earlier successful runs | A copied access token may have expired even if a developer's local CLI still works by refreshing its own token. Rotate the GitHub secret or migrate the workflow to OIDC. |
| OIDC cannot request a token | Add permissions: id-token: write and verify the provider name. |
JF_URL must be provided | Define JF_URL on the setup step, including for OIDC. |
| Job Summary has no working links | Store JF_URL as a variable, not a secret. |
| Build-info is published twice | Publish manually or rely on auto-publish, not both. Manual bp disables automatic publication for that build. |
| Build-info contains duplicate VCS entries | Do not run jf rt bag while relying on the action's automatic post-step metadata collection. Use the complete manual bce + bag + bp sequence, or leave all three to the action. |
| No build appears | Ensure a JFrog CLI build-aware package or upload command ran and auto-publish was not disabled. |
| Package alias is ignored | Use JFrog CLI 2.93.0 or later, inspect the alias warning, and check PATH ordering. |
| Wrong CLI server is selected | Set custom-server-id or select the intended server with jf c use. |
Examples
Related Topics
Updated about 1 month ago
