|
32 | 32 | branches: |
33 | 33 | - ionos-dev |
34 | 34 | - ionos-stable |
| 35 | + - 'rc/**' |
| 36 | + - '*/dev/*' |
35 | 37 | workflow_dispatch: |
36 | 38 | inputs: |
37 | 39 | force_rebuild: |
@@ -155,10 +157,10 @@ jobs: |
155 | 157 | echo " ✅ Event type is 'push'" |
156 | 158 | fi |
157 | 159 |
|
158 | | - VALID_BRANCH_PATTERN='^(ionos-dev|ionos-stable)$' |
| 160 | + VALID_BRANCH_PATTERN='^(ionos-dev|ionos-stable)$|^rc/.*$|^[^/]+/dev/.*$' |
159 | 161 | 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/*')" |
162 | 164 | WILL_TRIGGER=false |
163 | 165 | else |
164 | 166 | echo "- ✅ Branch is '\`${{ github.ref_name }}\`'" >> $GITHUB_STEP_SUMMARY |
@@ -656,10 +658,13 @@ jobs: |
656 | 658 |
|
657 | 659 | upload-to-artifactory: |
658 | 660 | 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 |
660 | 663 | if: | |
661 | 664 | 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/')) && |
663 | 668 | needs.prepare-matrix.result == 'success' && |
664 | 669 | (needs.build-apps.result == 'success' || needs.build-apps.result == 'skipped') && |
665 | 670 | needs.hidrive-next-build.result == 'success' |
@@ -735,21 +740,39 @@ jobs: |
735 | 740 | - name: Upload build to artifactory |
736 | 741 | id: artifactory_upload |
737 | 742 | 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 | |
740 | 751 |
|
741 | 752 | ARTIFACTORY_STAGE_PREFIX="dev" |
742 | 753 |
|
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 |
745 | 757 | 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}" |
746 | 763 | fi |
747 | 764 |
|
748 | 765 | 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" |
750 | 766 |
|
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" |
753 | 776 | fi |
754 | 777 |
|
755 | 778 | export PATH_TO_LATEST_ARTIFACT="${PATH_TO_DIRECTORY}/${PATH_TO_FILE}" |
@@ -869,13 +892,14 @@ jobs: |
869 | 892 |
|
870 | 893 | name: Trigger remote workflow |
871 | 894 | 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 |
873 | 896 | # Can be disabled via repository variable 'DISABLE_REMOTE_TRIGGER' (set to 'true' to disable) |
874 | 897 | # Configure at: https://github.com/IONOS-Productivity/nc-server/settings/variables/actions |
875 | 898 | if: | |
876 | 899 | always() && |
877 | 900 | 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/')) && |
879 | 903 | needs.hidrive-next-build.result == 'success' && |
880 | 904 | needs.upload-to-artifactory.result == 'success' && |
881 | 905 | vars.DISABLE_REMOTE_TRIGGER != 'true' |
@@ -936,16 +960,22 @@ jobs: |
936 | 960 | set -x |
937 | 961 |
|
938 | 962 | # 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> | |
943 | 969 |
|
944 | 970 | BUILD_TYPE="dev" |
945 | 971 |
|
946 | | - # Override build type for stable branch |
947 | | - if [ ${{ github.ref_name }} == "ionos-stable" ]; then |
| 972 | + if [ "${{ github.ref_name }}" == "ionos-stable" ]; then |
948 | 973 | 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}" |
949 | 979 | fi |
950 | 980 |
|
951 | 981 | # Construct source build URL for traceability |
|
0 commit comments