github.com/nilium/gitlab-runner@v12.5.0+incompatible/ci/release_gitlab (about)

     1  #!/usr/bin/env bash
     2  
     3  set -eo pipefail
     4  
     5  if [[ -z "${DEPLOY_TOKEN}" ]]; then
     6      echo -e "\033[0;31mMissing DEPLOY_TOKEN, cannot release\033[0m"
     7  
     8      exit 1
     9  fi
    10  
    11  tag=${1:-$CI_COMMIT_TAG}
    12  
    13  if [[ -z "${tag}" ]]; then
    14      echo -e "usage:\n\t$0 tag"
    15  
    16      exit 2
    17  fi
    18  
    19  api=${CI_API_V4_URL:-https://gitlab.com/api/v4}
    20  runner_id=${CI_PROJECT_ID:-250833}
    21  
    22  changelog="https://gitlab.com/gitlab-org/gitlab-runner/blob/$tag/CHANGELOG.md"
    23  s3="https://gitlab-runner-downloads.s3.amazonaws.com/$tag"
    24  release=$(cat <<EOS
    25  {
    26    "name": "$tag",
    27    "tag_name": "$tag",
    28    "description": "See [the changelog]($changelog) :rocket:",
    29    "assets": {
    30      "links": [
    31        { "name": "linux amd64", "url": "$s3/binaries/gitlab-runner-linux-amd64" },
    32        { "name": "linux arm", "url": "$s3/binaries/gitlab-runner-linux-arm" },
    33        { "name": "macOS", "url": "$s3/binaries/gitlab-runner-darwin-amd64" },
    34        { "name": "Windows 64 bits", "url": "$s3/binaries/gitlab-runner-windows-amd64.zip" },
    35        { "name": "Windows 32 bits", "url": "$s3/binaries/gitlab-runner-windows-386.zip" },
    36        { "name": "deb amd64", "url": "$s3/deb/gitlab-runner_amd64.deb" },
    37        { "name": "deb i386", "url": "$s3/deb/gitlab-runner_i386.deb" },
    38        { "name": "deb armel", "url": "$s3/deb/gitlab-runner_armel.deb" },
    39        { "name": "deb armhf", "url": "$s3/deb/gitlab-runner_armhf.deb" },
    40        { "name": "rpm amd64", "url": "$s3/rpm/gitlab-runner_amd64.rpm" },
    41        { "name": "rpm i686", "url": "$s3/rpm/gitlab-runner_i686.rpm" },
    42        { "name": "rpm arm", "url": "$s3/rpm/gitlab-runner_arm.rpm" },
    43        { "name": "rpm armhf", "url": "$s3/rpm/gitlab-runner_armhf.rpm" },
    44        { "name": "others", "url": "$s3/index.html" },
    45        { "name": "docs", "url": "https://docs.gitlab.com/runner/" }
    46      ]
    47    }
    48  }
    49  EOS
    50  )
    51  
    52  curl -f --header 'Content-Type: application/json' --header "PRIVATE-TOKEN: $DEPLOY_TOKEN" \
    53      --data "$release" --request POST "$api/projects/$runner_id/releases"
    54