Skip to content

Commit 28b64c8

Browse files
IONOS(ci): build rc/** + */dev/* branches with restructured JFrog paths
Enables push-build for rc/** and */dev/* branches, triggers the remote GitLab workflow for both, and routes their artifacts to nested JFrog paths that include NC_VERSION and short SHA so every build is preserved. JFrog layout (consolidated): | Branch/Event | Path | |---------------|--------------------------------------------------------------------| | Pull Request | pr/hidrive-next-pr-<n>.zip | | ionos-dev | dev/hidrive-next-<ver>/<sha>/hidrive-next-<ver>.zip | | ionos-stable | stable/hidrive-next-<ver>/<sha>/hidrive-next-<ver>.zip | | rc/* | rc/<branch>/hidrive-next-<ver>/<sha>/hidrive-next-<ver>.zip | | */dev/* | devs/<prefix>/hidrive-next-<ver>/<sha>/hidrive-next-<ver>.zip | Changes vs. previous behavior: - PR uploads move from dev/pr/... to top-level pr/... - */dev/* uploads change from dev-<prefix>/... to devs/<prefix>/... (folder instead of dash-suffix) GitLab BUILD_TYPE (consumer-facing) keeps dev-<prefix> — it is a separate naming contract from the JFrog path.
1 parent ab544ef commit 28b64c8

1 file changed

Lines changed: 50 additions & 20 deletions

File tree

.github/workflows/hidrive-next-build.yml

Lines changed: 50 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,8 @@ on:
3232
branches:
3333
- ionos-dev
3434
- ionos-stable
35+
- 'rc/**'
36+
- '*/dev/*'
3537
workflow_dispatch:
3638
inputs:
3739
force_rebuild:
@@ -155,10 +157,10 @@ jobs:
155157
echo " ✅ Event type is 'push'"
156158
fi
157159
158-
VALID_BRANCH_PATTERN='^(ionos-dev|ionos-stable)$'
160+
VALID_BRANCH_PATTERN='^(ionos-dev|ionos-stable)$|^rc/.*$|^[^/]+/dev/.*$'
159161
if [[ ! "${{ github.ref_name }}" =~ $VALID_BRANCH_PATTERN ]]; then
160-
echo "- ❌ Branch must be 'ionos-dev' or 'ionos-stable' (current: \`${{ github.ref_name }}\`)" >> $GITHUB_STEP_SUMMARY
161-
echo " ❌ Branch is '${{ github.ref_name }}' (must be 'ionos-dev' or 'ionos-stable')"
162+
echo "- ❌ Branch must be 'ionos-dev', 'ionos-stable', 'rc/*' or '*/dev/*' (current: \`${{ github.ref_name }}\`)" >> $GITHUB_STEP_SUMMARY
163+
echo " ❌ Branch is '${{ github.ref_name }}' (must be 'ionos-dev', 'ionos-stable', 'rc/*' or '*/dev/*')"
162164
WILL_TRIGGER=false
163165
else
164166
echo "- ✅ Branch is '\`${{ github.ref_name }}\`'" >> $GITHUB_STEP_SUMMARY
@@ -656,10 +658,13 @@ jobs:
656658
657659
upload-to-artifactory:
658660
runs-on: self-hosted
659-
# Upload the artifact to the Artifactory repository on PR *OR* on "ionos-dev|ionos-stable" branch push
661+
# Upload the artifact to the Artifactory repository on PR *OR* on
662+
# "ionos-dev|ionos-stable|rc/*|*/dev/*" branch push *OR* on manual workflow_dispatch
660663
if: |
661664
always() &&
662-
(github.event_name == 'pull_request' || github.ref_name == 'ionos-dev' || github.ref_name == 'ionos-stable') &&
665+
(github.event_name == 'pull_request' || github.event_name == 'workflow_dispatch' ||
666+
github.ref_name == 'ionos-dev' || github.ref_name == 'ionos-stable' ||
667+
startsWith(github.ref_name, 'rc/') || contains(github.ref_name, '/dev/')) &&
663668
needs.prepare-matrix.result == 'success' &&
664669
(needs.build-apps.result == 'success' || needs.build-apps.result == 'skipped') &&
665670
needs.hidrive-next-build.result == 'success'
@@ -735,21 +740,39 @@ jobs:
735740
- name: Upload build to artifactory
736741
id: artifactory_upload
737742
run: |
738-
# PR builds are stored in a separate directory as "dev/pr/hidrive-next-pr-<number>.zip"
739-
# Push to "ionos-dev" branch is stored as "dev/hidrive-next-<ncVersion>.zip"
743+
# Artifactory Build Storage Structure:
744+
# | Branch/Event | Stage Prefix | Artifact Path |
745+
# |------------------|------------------|------------------------------------------------------------------------------|
746+
# | Pull Request | pr | pr/hidrive-next-pr-<number>.zip |
747+
# | ionos-dev | dev | dev/hidrive-next-<ncVersion>/<shortSha>/hidrive-next-<ncVersion>.zip |
748+
# | ionos-stable | stable | stable/hidrive-next-<ncVersion>/<shortSha>/hidrive-next-<ncVersion>.zip |
749+
# | rc/* | <ref-name> | rc/<branch>/hidrive-next-<ncVersion>/<shortSha>/hidrive-next-<ncVersion>.zip |
750+
# | */dev/* | devs/<prefix> | devs/<prefix>/hidrive-next-<ncVersion>/<shortSha>/hidrive-next-<ncVersion>.zip |
740751
741752
ARTIFACTORY_STAGE_PREFIX="dev"
742753
743-
# set ARTIFACTORY_STAGE_PREFIX=stable on ionos-stable branch
744-
if [ ${{ github.ref_name }} == "ionos-stable" ]; then
754+
if [ -n "${{ github.event.pull_request.number }}" ]; then
755+
ARTIFACTORY_STAGE_PREFIX="pr"
756+
elif [ "${{ github.ref_name }}" == "ionos-stable" ]; then
745757
ARTIFACTORY_STAGE_PREFIX="stable"
758+
elif [[ "${{ github.ref_name }}" =~ ^rc/.*$ ]]; then
759+
ARTIFACTORY_STAGE_PREFIX="${{ github.ref_name }}"
760+
elif [[ "${{ github.ref_name }}" =~ ^.*/dev/.*$ ]]; then
761+
BRANCH_PREFIX=$(echo "${{ github.ref_name }}" | sed 's|/.*||' | sed 's/[^A-Za-z0-9._-]/-/g')
762+
ARTIFACTORY_STAGE_PREFIX="devs/${BRANCH_PREFIX}"
746763
fi
747764
748765
export PATH_TO_DIRECTORY="${{ env.ARTIFACTORY_REPOSITORY_SNAPSHOT }}/${ARTIFACTORY_STAGE_PREFIX}"
749-
PATH_TO_FILE="pr/hidrive-next-pr-${{ github.event.pull_request.number }}.zip"
750766
751-
if [ -z "${{ github.event.pull_request.number }}" ]; then
752-
PATH_TO_FILE="hidrive-next-${{ needs.hidrive-next-build.outputs.NC_VERSION }}.zip"
767+
if [ -n "${{ github.event.pull_request.number }}" ]; then
768+
# PR uploads keep the flat layout (one slot per PR number, top-level pr/)
769+
PATH_TO_FILE="hidrive-next-pr-${{ github.event.pull_request.number }}.zip"
770+
else
771+
# branch uploads nest under <ncVersion>/<shortSha>/ to preserve every build
772+
SHORT_SHA="${{ github.sha }}"
773+
SHORT_SHA="${SHORT_SHA:0:7}"
774+
NC_VERSION="${{ needs.hidrive-next-build.outputs.NC_VERSION }}"
775+
PATH_TO_FILE="hidrive-next-${NC_VERSION}/${SHORT_SHA}/hidrive-next-${NC_VERSION}.zip"
753776
fi
754777
755778
export PATH_TO_LATEST_ARTIFACT="${PATH_TO_DIRECTORY}/${PATH_TO_FILE}"
@@ -869,13 +892,14 @@ jobs:
869892

870893
name: Trigger remote workflow
871894
needs: [ hidrive-next-build, upload-to-artifactory ]
872-
# Trigger remote build on "ionos-dev|ionos-stable" branch *push* defined in the on:push:branches
895+
# Trigger remote build on "ionos-dev|ionos-stable|rc/*|*/dev/*" branch *push* defined in on:push:branches
873896
# Can be disabled via repository variable 'DISABLE_REMOTE_TRIGGER' (set to 'true' to disable)
874897
# Configure at: https://github.com/IONOS-Productivity/nc-server/settings/variables/actions
875898
if: |
876899
always() &&
877900
github.event_name == 'push' &&
878-
(github.ref_name == 'ionos-dev' || github.ref_name == 'ionos-stable') &&
901+
(github.ref_name == 'ionos-dev' || github.ref_name == 'ionos-stable' ||
902+
startsWith(github.ref_name, 'rc/') || contains(github.ref_name, '/dev/')) &&
879903
needs.hidrive-next-build.result == 'success' &&
880904
needs.upload-to-artifactory.result == 'success' &&
881905
vars.DISABLE_REMOTE_TRIGGER != 'true'
@@ -936,16 +960,22 @@ jobs:
936960
set -x
937961
938962
# Branch to GitLab Trigger Mapping (see HDNEXT-1373):
939-
# | ref_name | GITLAB_REF | BUILD_TYPE |
940-
# |--------------|------------|------------|
941-
# | ionos-dev | main | dev |
942-
# | ionos-stable | main | stable |
963+
# | ref_name | GITLAB_REF | BUILD_TYPE |
964+
# |--------------|------------|-------------------|
965+
# | ionos-dev | main | dev |
966+
# | ionos-stable | main | stable |
967+
# | rc/* | main | rc |
968+
# | */dev/* | main | dev-<branch-pfx> |
943969
944970
BUILD_TYPE="dev"
945971
946-
# Override build type for stable branch
947-
if [ ${{ github.ref_name }} == "ionos-stable" ]; then
972+
if [ "${{ github.ref_name }}" == "ionos-stable" ]; then
948973
BUILD_TYPE="stable"
974+
elif [[ "${{ github.ref_name }}" =~ ^rc/ ]]; then
975+
BUILD_TYPE="rc"
976+
elif [[ "${{ github.ref_name }}" =~ ^.*/dev/.*$ ]]; then
977+
BRANCH_PREFIX=$(echo "${{ github.ref_name }}" | sed 's|/.*||' | sed 's/[^A-Za-z0-9._-]/-/g')
978+
BUILD_TYPE="dev-${BRANCH_PREFIX}"
949979
fi
950980
951981
# Construct source build URL for traceability

0 commit comments

Comments
 (0)