|
| 1 | +# Upload to JFrog Artifactory Workflow |
| 2 | + |
| 3 | +A reusable GitHub Actions workflow for uploading artifacts to JFrog Artifactory following best practices for repository naming and organization. |
| 4 | + |
| 5 | +## Overview |
| 6 | + |
| 7 | +This workflow uploads build artifacts to JFrog Artifactory. It automatically categorizes files by type and uploads them to the appropriate repositories: |
| 8 | + |
| 9 | +- **DEB packages** → `{project}-deb-dev-local` |
| 10 | +- **RPM packages** → `{project}-rpm-dev-local` |
| 11 | +- **Generic files** → `{project}-generic-dev-local` |
| 12 | + |
| 13 | +The workflow processes artifacts from a `build-artifacts` directory and creates structured build artifacts before uploading. |
| 14 | + |
| 15 | +### Debian/Ubuntu Structure |
| 16 | + |
| 17 | +```text |
| 18 | +pool/ |
| 19 | +├── bookworm/ |
| 20 | +│ └── {package-name}/ |
| 21 | +│ ├── {package-name}_version_debian12_arch.deb |
| 22 | +│ └── {package-name}_version_debian12_arch.deb.asc |
| 23 | +├── bullseye/ |
| 24 | +│ └── {package-name}/ |
| 25 | +│ └── {package-name}_version_debian11_arch.deb |
| 26 | +├── jammy/ |
| 27 | +│ └── {package-name}/ |
| 28 | +│ └── {package-name}_version_ubuntu22.04_arch.deb |
| 29 | +└── noble/ |
| 30 | + └── {package-name}/ |
| 31 | + └── {package-name}_version_ubuntu24.04_arch.deb |
| 32 | +``` |
| 33 | + |
| 34 | +### RPM/Yum Structure |
| 35 | + |
| 36 | +```text |
| 37 | +repo/ |
| 38 | +├── el8/ |
| 39 | +│ ├── x86_64/ |
| 40 | +│ │ ├── *.rpm |
| 41 | +│ │ └── repodata/ |
| 42 | +│ └── aarch64/ |
| 43 | +│ ├── *.rpm |
| 44 | +│ └── repodata/ |
| 45 | +├── el9/ |
| 46 | +│ └── … |
| 47 | +└── amzn2023/ |
| 48 | + └── … |
| 49 | +``` |
| 50 | + |
| 51 | +## Inputs |
| 52 | + |
| 53 | +| Input | Description | Required | Default | |
| 54 | +| -------------------------------- | ------------------------------------- | -------- | ---------------------------- | |
| 55 | +| `project` | JFrog Artifactory project name | Yes | - | |
| 56 | +| `build-prefix` | Prefix for the build name | Yes | - | |
| 57 | +| `version` | Version string for build info | Yes | - | |
| 58 | +| `artifactory-url` | JFrog Artifactory URL | No | `https://aerospike.jfrog.io` | |
| 59 | +| `artifactory-oidc-provider-name` | OIDC provider name for authentication | No | `gh-citrusleaf` | |
| 60 | +| `artifactory-oidc-audience` | OIDC audience for authentication | No | `citrusleaf` | |
| 61 | +| `build-artifacts-name` | Name of the artifacts to download | No | `build-artifacts` | |
| 62 | +| `dry-run` | Whether to run in dry-run mode | No | `false` | |
| 63 | + |
| 64 | +## Example Usage |
| 65 | + |
| 66 | +```yaml |
| 67 | +name: Upload to Artifactory |
| 68 | +on: |
| 69 | + workflow_dispatch: |
| 70 | + push: |
| 71 | + tags: ["v*"] |
| 72 | + |
| 73 | +jobs: |
| 74 | + upload: |
| 75 | + uses: ./.github/workflows/reusable_upload-artifacts.yaml |
| 76 | + with: |
| 77 | + project: database |
| 78 | + build-prefix: database |
| 79 | + version: ${{ github.ref_name }} |
| 80 | + artifactory-url: https://aerospike.jfrog.io |
| 81 | + artifactory-oidc-provider-name: gh-citrusleaf |
| 82 | + artifactory-oidc-audience: citrusleaf |
| 83 | + build-artifacts-name: build-artifacts |
| 84 | + dry-run: false |
| 85 | +``` |
| 86 | +
|
| 87 | +### Build Info Publishing |
| 88 | +
|
| 89 | +After uploading artifacts, the workflow publishes comprehensive build information: |
| 90 | +
|
| 91 | +- Environment variables |
| 92 | +- Git information |
| 93 | +- Dependencies |
| 94 | +- Build metadata |
| 95 | +
|
| 96 | +The workflow creates separate build info for each artifact type: |
| 97 | +
|
| 98 | +- `{build-prefix}-deb` for DEB packages |
| 99 | +- `{build-prefix}-rpm` for RPM packages |
| 100 | +- `{build-prefix}-generic` for generic files |
| 101 | + |
| 102 | +## Prerequisites |
| 103 | + |
| 104 | +- JFrog Artifactory instance with OIDC authentication configured |
| 105 | +- GitHub Actions with OIDC token access to Artifactory |
| 106 | +- Build artifacts available as downloadable artifacts |
| 107 | + |
| 108 | +## Notes |
| 109 | + |
| 110 | +- The workflow expects artifacts to be in a directory called `build-artifacts` |
| 111 | +- All uploads use the "DEV" environment level and "local" locator |
| 112 | +- Build info is published for each artifact type separately |
| 113 | +- The workflow processes DEB and RPM files and creates structured build artifacts before uploading |
| 114 | +- Generic files are uploaded directly without structured processing |
0 commit comments