name: PetClinic JFrog CI on: push: branches: [ "main" ] # Triggers on every push to main workflow_dispatch: # Adds a "Run workflow" button in the GitHub UIjobs: build-and-publish: runs-on: ubuntu-latest permissions: contents: read id-token: write # MANDATORY: Required to request the JWT from GitHub steps: - name: Checkout Code uses: actions/checkout@v4 # Setup JFrog CLI using OIDC instead of Secrets - name: Set up JFrog CLI uses: jfrog/setup-jfrog-cli@v4 env: JF_URL: ${{ secrets.JF_URL }} # Still need the URL, but no token needed! with: version: latest oidc-provider-name: github-oidc-provider # Must match name in JFrog oidc-audience: jfrog-github # Must match audience in JFrog # 1. Configure the build tool (Example for a Node.js project) - name: Configure NPM run: | jf npm-config --repo-resolve=npm-virtual --repo-deploy=npm-local # 2. Run the build and collect "Build-Info" # The 'jf' wrapper automatically records dependencies and environment variables - name: Build and Collect Info run: | jf npm install --build-name=petclinic-ci --build-number=${{ github.run_number }} jf npm publish --build-name=petclinic-ci --build-number=${{ github.run_number }} # 3. Publish the Build-Info to Artifactory # This is the command that makes the build appear in the "Builds" tab - name: Publish Build Info run: | jf rt bp petclinic-ci ${{ github.run_number }}