github.com/containerd/Containerd@v1.4.13/.github/workflows/release.yml (about)

     1  on:
     2    push:
     3      tags:
     4        - 'v*' # Push events to matching v*, i.e. v1.0, v20.15.10
     5  
     6  name: Containerd Release
     7  
     8  jobs:
     9    check:
    10      name: Check Signed Tag
    11      runs-on: ubuntu-18.04
    12      timeout-minutes: 5
    13      outputs:
    14        stringver: ${{ steps.contentrel.outputs.stringver }}
    15  
    16      steps:
    17        - name: Checkout code
    18          uses: actions/checkout@v2
    19          with:
    20            ref: ${{ github.ref }}
    21            path: src/github.com/containerd/containerd
    22  
    23        - name: Check signature
    24          run: |
    25            releasever=${{ github.ref }}
    26            releasever="${releasever#refs/tags/}"
    27            TAGCHECK=$(git tag -v ${releasever} 2>&1 >/dev/null) ||
    28            echo "${TAGCHECK}" | grep -q "error" && {
    29                echo "::error::tag ${releasever} is not a signed tag. Failing release process."
    30                exit 1
    31            } || {
    32                echo "Tag ${releasever} is signed."
    33                exit 0
    34            }
    35          working-directory: src/github.com/containerd/containerd
    36  
    37        - name: Release content
    38          id: contentrel
    39          run: |
    40            RELEASEVER=${{ github.ref }}
    41            echo "::set-output name=stringver::${RELEASEVER#refs/tags/v}"
    42            git tag -l ${RELEASEVER#refs/tags/} -n20000 | tail -n +3 | cut -c 5- >release-notes.md
    43          working-directory: src/github.com/containerd/containerd
    44  
    45        - name: Save release notes
    46          uses: actions/upload-artifact@v2
    47          with:
    48            name: containerd-release-notes
    49            path: src/github.com/containerd/containerd/release-notes.md
    50  
    51    build:
    52      name: Build Release Binaries
    53      runs-on: ${{ matrix.os }}
    54      needs: [check]
    55      timeout-minutes: 10
    56  
    57      strategy:
    58        matrix:
    59          os: [ubuntu-18.04, windows-2019]
    60  
    61      steps:
    62        - name: Install Go
    63          uses: actions/setup-go@v2
    64          with:
    65            go-version: '1.16.14'
    66  
    67        - name: Set env
    68          shell: bash
    69          env:
    70            MOS: ${{ matrix.os }}
    71          run: |
    72            releasever=${{ github.ref }}
    73            releasever="${releasever#refs/tags/}"
    74            os=linux
    75            [[ "${MOS}" =~ "windows" ]] && {
    76              os=windows
    77            }
    78            echo "RELEASE_VER=${releasever}" >> $GITHUB_ENV
    79            echo "GOPATH=${{ github.workspace }}" >> $GITHUB_ENV
    80            echo "OS=${os}" >> $GITHUB_ENV
    81            echo "${{ github.workspace }}/bin" >> $GITHUB_PATH
    82  
    83        - name: Checkout containerd
    84          uses: actions/checkout@v2
    85          with:
    86            repository: containerd/containerd
    87            ref: ${{ github.ref }}
    88            path: src/github.com/containerd/containerd
    89  
    90        - name: HCS Shim commit
    91          id: hcsshim_commit
    92          if: startsWith(matrix.os, 'windows')
    93          shell: bash
    94          run: echo "::set-output name=sha::$(grep Microsoft/hcsshim vendor.conf | awk '{print $2}')"
    95          working-directory: src/github.com/containerd/containerd
    96  
    97        - name: Checkout hcsshim source
    98          if: startsWith(matrix.os, 'windows')
    99          uses: actions/checkout@v2
   100          with:
   101            repository: Microsoft/hcsshim
   102            ref: ${{ steps.hcsshim_commit.outputs.sha }}
   103            path: src/github.com/Microsoft/hcsshim
   104  
   105        - name: Make
   106          env:
   107            GO111MODULE: off
   108          shell: bash
   109          run: |
   110            make build
   111            make binaries
   112            rm bin/containerd-stress*
   113            [[ "${OS}" == "windows" ]] && {
   114                (
   115                  bindir="$(pwd)/bin"
   116                  cd ../../Microsoft/hcsshim
   117                  GO111MODULE=on go build -mod=vendor -o "${bindir}/containerd-shim-runhcs-v1.exe" ./cmd/containerd-shim-runhcs-v1
   118                )
   119            }
   120            TARFILE="containerd-${RELEASE_VER#v}-${OS}-amd64.tar.gz"
   121            tar czf ${TARFILE} bin/
   122            sha256sum ${TARFILE} >${TARFILE}.sha256sum
   123          working-directory: src/github.com/containerd/containerd
   124  
   125        - name: Save build binaries
   126          uses: actions/upload-artifact@v2
   127          with:
   128            name: containerd-binaries-${{ matrix.os }}
   129            path: src/github.com/containerd/containerd/*.tar.gz*
   130  
   131        - name: Install cri-containerd dependencies
   132          shell: bash
   133          env:
   134            RUNC_FLAVOR: runc
   135            DESTDIR: ${{ github.workspace }}/cri-release
   136          run: |
   137            mkdir ${DESTDIR}
   138            if [[ "${OS}" == "linux" ]]; then
   139              sudo install -d ${DESTDIR}/usr/local/bin
   140              sudo install -D -m 755 bin/* ${DESTDIR}/usr/local/bin
   141              sudo install -d ${DESTDIR}/opt/containerd/cluster
   142              sudo cp -r contrib/gce ${DESTDIR}/opt/containerd/cluster/
   143              sudo install -d ${DESTDIR}/etc/systemd/system
   144              sudo install -m 644 containerd.service ${DESTDIR}/etc/systemd/system
   145              echo "CONTAINERD_VERSION: '${RELEASE_VER#v}'" | sudo tee ${DESTDIR}/opt/containerd/cluster/version
   146  
   147              sudo PATH=$PATH script/setup/install-seccomp
   148              USESUDO=true script/setup/install-runc
   149              script/setup/install-cni
   150              script/setup/install-critools
   151            elif [[ "${OS}" == "windows" ]]; then
   152              script/setup/install-cni-windows
   153              cp bin/* ${DESTDIR}/
   154            fi
   155          working-directory: src/github.com/containerd/containerd
   156  
   157        - name: Make cri-containerd tar
   158          shell: bash
   159          run: |
   160            TARFILE="cri-containerd-cni-${RELEASE_VER#v}-${OS}-amd64.tar.gz"
   161            [[ "${OS}" == "linux" ]] && tar czf ${TARFILE} etc usr opt
   162            [[ "${OS}" == "windows" ]] && tar czf ${TARFILE} *
   163            sha256sum ${TARFILE} >${TARFILE}.sha256sum
   164          working-directory: cri-release
   165  
   166        - name: Save cri-containerd binaries
   167          uses: actions/upload-artifact@v2
   168          with:
   169            name: cri-containerd-binaries-${{ matrix.os }}
   170            path: cri-release/cri-containerd-cni-*.tar.gz*
   171  
   172    release:
   173      name: Create containerd Release
   174      runs-on: ubuntu-18.04
   175      timeout-minutes: 10
   176      needs: [build, check]
   177  
   178      steps:
   179        - name: Download builds and release notes
   180          uses: actions/download-artifact@v2
   181          with:
   182            path: builds
   183        - name: Catalog build assets for upload
   184          id: catalog
   185          run: |
   186            _filenum=1
   187            for i in "ubuntu-18.04" "windows-2019"; do
   188              for f in `ls builds/containerd-binaries-${i}`; do
   189                echo "::set-output name=file${_filenum}::${f}"
   190                let "_filenum+=1"
   191              done
   192              for f in `ls builds/cri-containerd-binaries-${i}`; do
   193                echo "::set-output name=file${_filenum}::${f}"
   194                let "_filenum+=1"
   195              done
   196            done
   197        - name: Create Release
   198          id: create_release
   199          uses: actions/create-release@v1.1.2
   200          env:
   201            GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
   202          with:
   203            tag_name: ${{ github.ref }}
   204            release_name: containerd ${{ needs.check.outputs.stringver }}
   205            body_path: ./builds/containerd-release-notes/release-notes.md
   206            draft: false
   207            prerelease: ${{ contains(github.ref, 'beta') || contains(github.ref, 'rc') }}
   208        - name: Upload Linux containerd tarball
   209          uses: actions/upload-release-asset@v1
   210          env:
   211            GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
   212          with:
   213            upload_url: ${{ steps.create_release.outputs.upload_url }}
   214            asset_path: ./builds/containerd-binaries-ubuntu-18.04/${{ steps.catalog.outputs.file1 }}
   215            asset_name: ${{ steps.catalog.outputs.file1 }}
   216            asset_content_type: application/gzip
   217        - name: Upload Linux sha256 sum
   218          uses: actions/upload-release-asset@v1
   219          env:
   220            GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
   221          with:
   222            upload_url: ${{ steps.create_release.outputs.upload_url }}
   223            asset_path: ./builds/containerd-binaries-ubuntu-18.04/${{ steps.catalog.outputs.file2 }}
   224            asset_name: ${{ steps.catalog.outputs.file2 }}
   225            asset_content_type: text/plain
   226        - name: Upload Linux cri containerd tarball
   227          uses: actions/upload-release-asset@v1
   228          env:
   229            GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
   230          with:
   231            upload_url: ${{ steps.create_release.outputs.upload_url }}
   232            asset_path: ./builds/cri-containerd-binaries-ubuntu-18.04/${{ steps.catalog.outputs.file3 }}
   233            asset_name: ${{ steps.catalog.outputs.file3 }}
   234            asset_content_type: application/gzip
   235        - name: Upload Linux cri sha256 sum
   236          uses: actions/upload-release-asset@v1
   237          env:
   238            GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
   239          with:
   240            upload_url: ${{ steps.create_release.outputs.upload_url }}
   241            asset_path: ./builds/cri-containerd-binaries-ubuntu-18.04/${{ steps.catalog.outputs.file4 }}
   242            asset_name: ${{ steps.catalog.outputs.file4 }}
   243            asset_content_type: text/plain
   244        - name: Upload Windows containerd tarball
   245          uses: actions/upload-release-asset@v1
   246          env:
   247            GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
   248          with:
   249            upload_url: ${{ steps.create_release.outputs.upload_url }}
   250            asset_path: ./builds/containerd-binaries-windows-2019/${{ steps.catalog.outputs.file5 }}
   251            asset_name: ${{ steps.catalog.outputs.file5 }}
   252            asset_content_type: application/gzip
   253        - name: Upload Windows sha256 sum
   254          uses: actions/upload-release-asset@v1
   255          env:
   256            GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
   257          with:
   258            upload_url: ${{ steps.create_release.outputs.upload_url }}
   259            asset_path: ./builds/containerd-binaries-windows-2019/${{ steps.catalog.outputs.file6 }}
   260            asset_name: ${{ steps.catalog.outputs.file6 }}
   261            asset_content_type: text/plain
   262        - name: Upload Windows cri containerd tarball
   263          uses: actions/upload-release-asset@v1
   264          env:
   265            GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
   266          with:
   267            upload_url: ${{ steps.create_release.outputs.upload_url }}
   268            asset_path: ./builds/cri-containerd-binaries-windows-2019/${{ steps.catalog.outputs.file7 }}
   269            asset_name: ${{ steps.catalog.outputs.file7 }}
   270            asset_content_type: application/gzip
   271        - name: Upload Windows cri sha256 sum
   272          uses: actions/upload-release-asset@v1
   273          env:
   274            GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
   275          with:
   276            upload_url: ${{ steps.create_release.outputs.upload_url }}
   277            asset_path: ./builds/cri-containerd-binaries-windows-2019/${{ steps.catalog.outputs.file8 }}
   278            asset_name: ${{ steps.catalog.outputs.file8 }}
   279            asset_content_type: text/plain