Commit 71e21859 authored by Federico Falconieri's avatar Federico Falconieri
Browse files

Merge branch 'remote' into 'main'

feat: remote url generator

See merge request just-ci/templates!96
parents 3ae7025c c1b85373
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
---
include:
  - local: project-automation/workflow.yml
  - local: "python/flawfinder.yml"
  - local: "c/cppcheck.yml"
  - local: python/flawfinder.yml
  - local: c/cppcheck.yml

variables:
  FLAWFINDER_ERROR_LEVEL: "3"
+7 −7
Original line number Diff line number Diff line
---
include:
  - local: "cd/ssh/ssh.yml"
  - local: "cd/ssh/docker-login.yml"
  - local: "cd/ssh/make.yml"
  - local: "cd/ssh/scp.yml"
  - local: cd/ssh/ssh.yml
  - local: cd/ssh/docker-login.yml
  - local: cd/ssh/make.yml
  - local: cd/ssh/scp.yml

variables:
  REMOTE_USER: ubuntu
@@ -26,8 +26,8 @@ deploy:make:

.ssh:
  rules:
    - if: "$CI_COMMIT_TAG"
    - if: $CI_COMMIT_TAG
      when: never
    - if: "$CI_COMMIT_REF_PROTECTED"
    - if: $CI_COMMIT_REF_PROTECTED
      variables:
        MAKE_EXTRA_ARGS: "DEPLOYED_BRANCH=$CI_COMMIT_REF"
        MAKE_EXTRA_ARGS: DEPLOYED_BRANCH=$CI_COMMIT_REF
+6 −6
Original line number Diff line number Diff line
---
include:
  - local: "project-automation/badge.yml"
  - local: "project-automation/pages-hugo.yml"
  - local: project-automation/badge.yml
  - local: project-automation/pages-hugo.yml

badge:pages:
  extends: .badge
  variables:
    NAME: "GitLab"
    VALUE: "Pages"
    COLOR: "teal"
    URL: "${CI_PAGES_URL}"
    NAME: GitLab
    VALUE: Pages
    COLOR: teal
    URL: ${CI_PAGES_URL}
+4 −4
Original line number Diff line number Diff line
---
include:
  - local: project-automation/workflow.yml
  - local: "python/collections/quality.yml"
  - local: "python/collections/release.yml"
  - local: "python/collections/security.yml"
  - local: "python/collections/style.yml"
  - local: python/collections/quality.yml
  - local: python/collections/release.yml
  - local: python/collections/security.yml
  - local: python/collections/style.yml

python:twine:
  rules:
+41 −0
Original line number Diff line number Diff line
---
pages:
  stage: build
  image:
    name: docker.io/alpine/git:latest
    entrypoint: [""]
  variables:
    GIT_STRATEGY: clone
  script:
    - |
      if [ "$(git rev-parse --is-shallow-repository)" != "false" ]; then
        echo "[*] Repository is shallow. Unshallowing."
        git fetch --unshallow -q
      fi
    - apk add -q grep
    - GIT_TAGS=$(git tag --format "%(refname:strip=1)") # Produces list with 'tags/' prefix
    - GIT_BRANCHES=$(git branch -r --format "%(refname:strip=3)")
    - mkdir -p /tmp/public
    - |
      for GIT_REF in ${GIT_TAGS} ${GIT_BRANCHES}; do
        printf "[*] Processing ${GIT_REF}..."
        git checkout ${GIT_REF} -q

        FILES=$(grep -rl "\- local: " . --exclude-dir=tests --exclude=.gitlab-ci.yml --exclude=pages-templates.yaml)
        printf "$(echo ${FILES} | wc -w) file(s)..."

        GIT_REF_NAME=${GIT_REF#tags/}
        echo ${FILES} | xargs sed -i "s|- local: \"|- remote: \"${CI_PAGES_URL}/${GIT_REF_NAME}/|g"
        echo ${FILES} | xargs sed -i "s|- local: |- remote: ${CI_PAGES_URL}/${GIT_REF_NAME}/|g"
        cp -r . /tmp/public/${GIT_REF_NAME}

        git reset --hard -q
        echo "done."
      done
    - echo "[*] Publishing $(echo $GIT_TAGS | wc -w) tags and $(echo
      $GIT_BRANCHES | wc -w) branches to ${CI_PAGES_URL}..."
    - mv /tmp/public ${CI_PROJECT_DIR}/public
  needs: []
  artifacts:
    paths:
      - public
Loading