.gitlab-ci.yml 2.11 KB
Newer Older
Ben Avison's avatar
Ben Avison committed
1 2 3
include:
  - project: 'bavison/ci'
    file: '/builder.yml'
Ben Avison's avatar
Ben Avison committed
4 5 6 7 8 9 10

deploy:
  stage: deploy
  only:
    refs: [ master ]
  tags: [ cross ]
  script:
Ben Avison's avatar
Ben Avison committed
11 12 13
    # Depending on whether the pipeline is launched by the merge request or
    # manually, VersionNum may or may not have been updated. Switch to the
    # tip of master to ensure consistency.
Ben Avison's avatar
Ben Avison committed
14
    - git checkout origin/master
Ben Avison's avatar
Ben Avison committed
15
    - SOURCETAG=$(git describe --abbrev=8 --tags --always)
Ben Avison's avatar
Ben Avison committed
16 17 18 19 20
    # As soon as the CI stuff is merged into the central project, update group and branch identifiers.
    - 'curl --location --output RiscOS.zip "https://gitlab.riscosopen.org/bavison/BuildHost/-/jobs/artifacts/ci/download?job=latest_package_tree"'
    - unzip -q RiscOS.zip
    - shopt -s expand_aliases && source RiscOS/Env/ROOL/BuildHost.sh
    - git clone https://gitbot:$PASSWORD@gitlab.riscosopen.org/gitbot/PlingBuilder
Ben Avison's avatar
Ben Avison committed
21 22 23
    - make links
    - ln -s ../PlingBuilder objs/!Builder
    - COMPONENT=Builder TARGET=Builder INSTDIR=. make install
Ben Avison's avatar
Ben Avison committed
24 25 26 27 28 29 30 31
    # If the installed binary has changed in any way, then...
    # - if major version number is unchanged, then do an untagged merge request
    #   (most likely this means there have been toolchain and/or library
    #   changes since the binary was last imported)
    # - otherwise, create a VersionNum file that is 0.01 behind the source
    #   component, and let the srccommit instance that runs during the merge
    #   bring the source and binary versions back to parity
    - cd PlingBuilder && git diff --quiet --exit-code || ( git checkout -b Import$(echo $SOURCETAG | sed -e 's/[.-_]//g'); if diff <(head -1 ../VersionNum) <(head -1 VersionNum) &> /dev/null; then git add .; git commit -m "Binary import from source version "$SOURCETAG$'\n!NoTag'; else NEXTVER=$(sed $'1s/^.*(\\(.*\\)).*$/\\1/;t\nd' ../VersionNum); INTVER=${NEXTVER%%.*}; FRACVER=${NEXTVER#*.}; FRACVER=${FRACVER#0}; if [ $FRACVER = 0 ]; then INTVER=$((INTVER-1)); FRACVER=99; else FRACVER=$((FRACVER-1)); fi; PREVER=$(printf "%d.%02d" $INTVER $FRACVER); echo "($PREVER)" > VersionNum; git add .; git commit -m "Binary import from source version "$SOURCETAG; fi; git push -o merge_request.create origin )