github.com/lalkh/containerd@v1.4.3/.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@v1
    64          with:
    65            go-version: '1.15.5'
    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          shell: bash
   107          run: |
   108            make build
   109            make binaries
   110            rm bin/containerd-stress*
   111            [[ "${OS}" == "windows" ]] && {
   112                (
   113                  bindir="$(pwd)/bin"
   114                  cd ../../Microsoft/hcsshim
   115                  GO111MODULE=on go build -mod=vendor -o "${bindir}/containerd-shim-runhcs-v1.exe" ./cmd/containerd-shim-runhcs-v1
   116                )
   117            }
   118            TARFILE="containerd-${RELEASE_VER#v}-${OS}-amd64.tar.gz"
   119            tar czf ${TARFILE} bin/
   120            sha256sum ${TARFILE} >${TARFILE}.sha256sum
   121          working-directory: src/github.com/containerd/containerd
   122  
   123        - name: Save build binaries
   124          uses: actions/upload-artifact@v2
   125          with:
   126            name: containerd-binaries-${{ matrix.os }}
   127            path: src/github.com/containerd/containerd/*.tar.gz*
   128  
   129        - name: Install cri-containerd dependencies
   130          shell: bash
   131          env:
   132            RUNC_FLAVOR: runc
   133            DESTDIR: ${{ github.workspace }}/cri-release
   134          run: |
   135            mkdir ${DESTDIR}
   136            if [[ "${OS}" == "linux" ]]; then
   137              sudo install -d ${DESTDIR}/usr/local/bin
   138              sudo install -D -m 755 bin/* ${DESTDIR}/usr/local/bin
   139              sudo install -d ${DESTDIR}/opt/containerd/cluster
   140              sudo cp -r contrib/gce ${DESTDIR}/opt/containerd/cluster/
   141              sudo install -d ${DESTDIR}/etc/systemd/system
   142              sudo install -m 644 containerd.service ${DESTDIR}/etc/systemd/system
   143              echo "CONTAINERD_VERSION: '${RELEASE_VER#v}'" | sudo tee ${DESTDIR}/opt/containerd/cluster/version
   144  
   145              sudo PATH=$PATH script/setup/install-seccomp
   146              USESUDO=true script/setup/install-runc
   147              script/setup/install-cni
   148              script/setup/install-critools
   149            elif [[ "${OS}" == "windows" ]]; then
   150              script/setup/install-cni-windows
   151              cp bin/* ${DESTDIR}/
   152            fi
   153          working-directory: src/github.com/containerd/containerd
   154  
   155        - name: Make cri-containerd tar
   156          shell: bash
   157          run: |
   158            TARFILE="cri-containerd-cni-${RELEASE_VER#v}-${OS}-amd64.tar.gz"
   159            [[ "${OS}" == "linux" ]] && tar czf ${TARFILE} etc usr opt
   160            [[ "${OS}" == "windows" ]] && tar czf ${TARFILE} *
   161            sha256sum ${TARFILE} >${TARFILE}.sha256sum
   162          working-directory: cri-release
   163  
   164        - name: Save cri-containerd binaries
   165          uses: actions/upload-artifact@v2
   166          with:
   167            name: cri-containerd-binaries-${{ matrix.os }}
   168            path: cri-release/cri-containerd-cni-*.tar.gz*
   169  
   170    release:
   171      name: Create containerd Release
   172      runs-on: ubuntu-18.04
   173      timeout-minutes: 10
   174      needs: [build, check]
   175  
   176      steps:
   177        - name: Download builds and release notes
   178          uses: actions/download-artifact@v2
   179          with:
   180            path: builds
   181        - name: Catalog build assets for upload
   182          id: catalog
   183          run: |
   184            _filenum=1
   185            for i in "ubuntu-18.04" "windows-2019"; do
   186              for f in `ls builds/containerd-binaries-${i}`; do
   187                echo "::set-output name=file${_filenum}::${f}"
   188                let "_filenum+=1"
   189              done
   190              for f in `ls builds/cri-containerd-binaries-${i}`; do
   191                echo "::set-output name=file${_filenum}::${f}"
   192                let "_filenum+=1"
   193              done
   194            done
   195        - name: Create Release
   196          id: create_release
   197          uses: actions/create-release@v1.1.2
   198          env:
   199            GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
   200          with:
   201            tag_name: ${{ github.ref }}
   202            release_name: containerd ${{ needs.check.outputs.stringver }}
   203            body_path: ./builds/containerd-release-notes/release-notes.md
   204            draft: false
   205            prerelease: ${{ contains(github.ref, 'beta') || contains(github.ref, 'rc') }}
   206        - name: Upload Linux containerd tarball
   207          uses: actions/upload-release-asset@v1
   208          env:
   209            GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
   210          with:
   211            upload_url: ${{ steps.create_release.outputs.upload_url }}
   212            asset_path: ./builds/containerd-binaries-ubuntu-18.04/${{ steps.catalog.outputs.file1 }}
   213            asset_name: ${{ steps.catalog.outputs.file1 }}
   214            asset_content_type: application/gzip
   215        - name: Upload Linux sha256 sum
   216          uses: actions/upload-release-asset@v1
   217          env:
   218            GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
   219          with:
   220            upload_url: ${{ steps.create_release.outputs.upload_url }}
   221            asset_path: ./builds/containerd-binaries-ubuntu-18.04/${{ steps.catalog.outputs.file2 }}
   222            asset_name: ${{ steps.catalog.outputs.file2 }}
   223            asset_content_type: text/plain
   224        - name: Upload Linux cri containerd tarball
   225          uses: actions/upload-release-asset@v1
   226          env:
   227            GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
   228          with:
   229            upload_url: ${{ steps.create_release.outputs.upload_url }}
   230            asset_path: ./builds/cri-containerd-binaries-ubuntu-18.04/${{ steps.catalog.outputs.file3 }}
   231            asset_name: ${{ steps.catalog.outputs.file3 }}
   232            asset_content_type: application/gzip
   233        - name: Upload Linux cri sha256 sum
   234          uses: actions/upload-release-asset@v1
   235          env:
   236            GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
   237          with:
   238            upload_url: ${{ steps.create_release.outputs.upload_url }}
   239            asset_path: ./builds/cri-containerd-binaries-ubuntu-18.04/${{ steps.catalog.outputs.file4 }}
   240            asset_name: ${{ steps.catalog.outputs.file4 }}
   241            asset_content_type: text/plain
   242        - name: Upload Windows containerd tarball
   243          uses: actions/upload-release-asset@v1
   244          env:
   245            GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
   246          with:
   247            upload_url: ${{ steps.create_release.outputs.upload_url }}
   248            asset_path: ./builds/containerd-binaries-windows-2019/${{ steps.catalog.outputs.file5 }}
   249            asset_name: ${{ steps.catalog.outputs.file5 }}
   250            asset_content_type: application/gzip
   251        - name: Upload Windows sha256 sum
   252          uses: actions/upload-release-asset@v1
   253          env:
   254            GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
   255          with:
   256            upload_url: ${{ steps.create_release.outputs.upload_url }}
   257            asset_path: ./builds/containerd-binaries-windows-2019/${{ steps.catalog.outputs.file6 }}
   258            asset_name: ${{ steps.catalog.outputs.file6 }}
   259            asset_content_type: text/plain
   260        - name: Upload Windows cri containerd tarball
   261          uses: actions/upload-release-asset@v1
   262          env:
   263            GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
   264          with:
   265            upload_url: ${{ steps.create_release.outputs.upload_url }}
   266            asset_path: ./builds/cri-containerd-binaries-windows-2019/${{ steps.catalog.outputs.file7 }}
   267            asset_name: ${{ steps.catalog.outputs.file7 }}
   268            asset_content_type: application/gzip
   269        - name: Upload Windows cri sha256 sum
   270          uses: actions/upload-release-asset@v1
   271          env:
   272            GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
   273          with:
   274            upload_url: ${{ steps.create_release.outputs.upload_url }}
   275            asset_path: ./builds/cri-containerd-binaries-windows-2019/${{ steps.catalog.outputs.file8 }}
   276            asset_name: ${{ steps.catalog.outputs.file8 }}
   277            asset_content_type: text/plain