github.com/jasonkeene/cli@v6.14.1-0.20160816203908-ca5715166dfb+incompatible/ci/cli/tasks/publish-final-release.yml (about)

     1  ---
     2  platform: linux
     3  image: docker:///cloudfoundry/cli-ci
     4  
     5  params:
     6    AWS_ACCESS_KEY_ID:
     7    AWS_SECRET_ACCESS_KEY:
     8  
     9  inputs:
    10  - name: final-cli
    11    path: cli
    12  - name: cf-cli-binaries
    13  - name: cf-cli-installers
    14  - name: cf-cli-installer-win32
    15  - name: cf-cli-installer-win64
    16  
    17  outputs:
    18  - name: cf-cli-osx-tarball
    19  
    20  run:
    21    path: bash
    22    args:
    23    - -c
    24    - |
    25      set -ex
    26  
    27      root=$PWD
    28  
    29      mkdir archives
    30      mkdir installers
    31  
    32      pushd cli
    33        git remote set-url origin https://github.com/cloudfoundry/cli.git
    34        git fetch --tags
    35        release_tag=$( git show-ref --tags -d | grep $(git rev-parse HEAD) | cut -d'/' -f3 | egrep 'v[0-9]' | cut -d'v' -f2 )
    36      popd
    37  
    38      if [ -z "${release_tag}" ]; then
    39        echo "Expected the commit that triggered this build to be tagged." >&2
    40        exit 1
    41      fi
    42  
    43      filename_regex="cf-cli(-installer)?([-_0-9a-z]+)?(\.[a-z]+)?"
    44  
    45      pushd cf-cli-binaries
    46        tar xvzf cf-cli-binaries.tgz
    47  
    48        for BIN in cf-cli_[lo]*; do # linux, osx
    49          [[ "${BIN}" =~ $filename_regex ]]
    50          os_arch="${BASH_REMATCH[2]}"
    51  
    52          cp ${BIN} cf
    53          tar cvzf $root/archives/cf-cli_${release_tag}${os_arch}.tgz cf
    54          rm cf
    55        done
    56  
    57        cp $root/archives/cf-cli_*_osx.tgz ../cf-cli-osx-tarball
    58  
    59        for BIN in cf-cli_win*; do
    60          [[ "${BIN}" =~ $filename_regex ]]
    61          os_arch="${BASH_REMATCH[2]}"
    62  
    63          cp ${BIN} cf.exe
    64          zip $root/archives/cf-cli_${release_tag}${os_arch}.zip cf.exe
    65          rm cf.exe
    66        done
    67      popd
    68  
    69      echo "Uploading final release"
    70  
    71      pushd archives
    72        for archive in *; do
    73            aws s3 cp $archive s3://go-cli/releases/v${release_tag}/${archive}
    74        done
    75      popd
    76  
    77      pushd cf-cli-installers
    78        tar xvzf cf-cli-installers.tgz -C $root/installers
    79      popd
    80  
    81      mv cf-cli-installer-win32/cf-cli-installer_win32.zip installers
    82      mv cf-cli-installer-win64/cf-cli-installer_winx64.zip installers
    83  
    84      pushd installers
    85        for installer in *; do
    86          [[ "${installer}" =~ $filename_regex ]]
    87          os_arch="${BASH_REMATCH[2]}"
    88          extension="${BASH_REMATCH[3]}"
    89          aws s3 cp $installer s3://go-cli/releases/v${release_tag}/cf-cli-installer_${release_tag}${os_arch}${extension}
    90        done
    91      popd