|
| 1 | +name: Republish Content Intelligence Package |
| 2 | + |
| 3 | +on: |
| 4 | + workflow_dispatch: |
| 5 | + inputs: |
| 6 | + version: |
| 7 | + description: 'Release version to publish (e.g. 4.0.4)' |
| 8 | + required: true |
| 9 | + branch: |
| 10 | + description: 'Branch to build from' |
| 11 | + required: true |
| 12 | + default: '2023' |
| 13 | + |
| 14 | +concurrency: |
| 15 | + group: republish-ci-package |
| 16 | + cancel-in-progress: false |
| 17 | + |
| 18 | +env: |
| 19 | + MAVEN_OPTS: >- |
| 20 | + -Dorg.slf4j.simpleLogger.log.org.apache.maven.cli.transfer.Slf4jMavenTransferListener=warn |
| 21 | + -Daether.syncContext.named.time=600 |
| 22 | + -Xms512m |
| 23 | + -Xmx1536m |
| 24 | +
|
| 25 | +permissions: |
| 26 | + contents: read |
| 27 | + |
| 28 | +jobs: |
| 29 | + republish: |
| 30 | + runs-on: ubuntu-latest |
| 31 | + env: |
| 32 | + VERSION: ${{ github.event.inputs.version }} |
| 33 | + steps: |
| 34 | + - name: Validate version format |
| 35 | + run: | |
| 36 | + if [[ ! "${{ github.event.inputs.version }}" =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]]; then |
| 37 | + echo "::error::Version '${{ github.event.inputs.version }}' does not match expected format X.Y.Z" |
| 38 | + exit 1 |
| 39 | + fi |
| 40 | +
|
| 41 | + - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 |
| 42 | + with: |
| 43 | + ref: ${{ github.event.inputs.branch }} |
| 44 | + fetch-depth: 1 |
| 45 | + |
| 46 | + - name: Setup Maven build |
| 47 | + uses: nuxeo/gh-build-tools/.github/actions/setup-maven-build@v0.9.0 |
| 48 | + with: |
| 49 | + java-version: 17 |
| 50 | + java-distribution: 'temurin' |
| 51 | + maven-settings: '.github/maven-settings.xml' |
| 52 | + env: |
| 53 | + MVN_REPO_USERNAME: ${{ secrets.REPOSITORY_MANAGER_USERNAME }} |
| 54 | + MVN_REPO_PASSWORD: ${{ secrets.REPOSITORY_MANAGER_PASSWORD }} |
| 55 | + |
| 56 | + - name: Set release version across all modules |
| 57 | + run: | |
| 58 | + mvn -B -nsu versions:set -DnewVersion="${VERSION}" -DgenerateBackupPoms=false |
| 59 | + env: |
| 60 | + MVN_REPO_USERNAME: ${{ secrets.REPOSITORY_MANAGER_USERNAME }} |
| 61 | + MVN_REPO_PASSWORD: ${{ secrets.REPOSITORY_MANAGER_PASSWORD }} |
| 62 | + |
| 63 | + - name: Build content-intelligence package and its dependencies |
| 64 | + run: | |
| 65 | + mvn -B -V -nsu -T 1C --no-transfer-progress -DskipTests clean install \ |
| 66 | + -pl addons/nuxeo-ai-content-intelligence-package -am |
| 67 | + env: |
| 68 | + MVN_REPO_USERNAME: ${{ secrets.REPOSITORY_MANAGER_USERNAME }} |
| 69 | + MVN_REPO_PASSWORD: ${{ secrets.REPOSITORY_MANAGER_PASSWORD }} |
| 70 | + |
| 71 | + - name: Verify package was built |
| 72 | + run: | |
| 73 | + PACKAGE="addons/nuxeo-ai-content-intelligence-package/target/nuxeo-ai-content-intelligence-package-${VERSION}.zip" |
| 74 | + if [[ ! -f "$PACKAGE" ]]; then |
| 75 | + echo "::error::Package not found at $PACKAGE" |
| 76 | + exit 1 |
| 77 | + fi |
| 78 | + echo "Package built successfully: $(ls -lh "$PACKAGE")" |
| 79 | +
|
| 80 | + - name: Deploy content-intelligence package to Maven repository |
| 81 | + run: | |
| 82 | + mvn -B -nsu --no-transfer-progress -DskipTests deploy \ |
| 83 | + -pl addons/nuxeo-ai-content-intelligence-package |
| 84 | + env: |
| 85 | + MVN_REPO_USERNAME: ${{ secrets.REPOSITORY_MANAGER_USERNAME }} |
| 86 | + MVN_REPO_PASSWORD: ${{ secrets.REPOSITORY_MANAGER_PASSWORD }} |
| 87 | + |
| 88 | + - name: Publish to Nuxeo Marketplace |
| 89 | + run: | |
| 90 | + PACKAGE="addons/nuxeo-ai-content-intelligence-package/target/nuxeo-ai-content-intelligence-package-${VERSION}.zip" |
| 91 | + echo "Publishing $(basename "$PACKAGE") to Nuxeo Marketplace..." |
| 92 | + STATUS_CODE=$(curl -i --silent --output /dev/null -w "%{http_code}" \ |
| 93 | + -u "${{ secrets.CONNECT_USERNAME }}:${{ secrets.CONNECT_PASSWORD }}" \ |
| 94 | + -F "package=@${PACKAGE}" \ |
| 95 | + "https://connect.nuxeo.com/nuxeo/site/marketplace/upload?batch=true") |
| 96 | + if [[ "$STATUS_CODE" != "200" ]]; then |
| 97 | + echo "::error::Marketplace upload failed — HTTP $STATUS_CODE" |
| 98 | + exit 1 |
| 99 | + fi |
| 100 | + echo "Successfully published to Nuxeo Marketplace" |
0 commit comments