1on: 2 push: 3 tags: 4 - 'v*' # Push events to matching v*, i.e. v1.0, v20.15.10 5 6name: Containerd Release 7 8jobs: 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.6' 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 ' go.mod | 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: Make cri-containerd tar 130 shell: bash 131 env: 132 RUNC_FLAVOR: runc 133 run: | 134 if [[ "${OS}" == "linux" ]]; then 135 sudo -E PATH=$PATH script/setup/install-seccomp 136 fi 137 make cri-cni-release 138 working-directory: src/github.com/containerd/containerd 139 140 - name: Save cri-containerd binaries 141 uses: actions/upload-artifact@v2 142 with: 143 name: cri-containerd-binaries-${{ matrix.os }} 144 path: src/github.com/containerd/containerd/releases/cri-containerd-cni-*.tar.gz* 145 146 release: 147 name: Create containerd Release 148 runs-on: ubuntu-18.04 149 timeout-minutes: 10 150 needs: [build, check] 151 152 steps: 153 - name: Download builds and release notes 154 uses: actions/download-artifact@v2 155 with: 156 path: builds 157 - name: Catalog build assets for upload 158 id: catalog 159 run: | 160 _filenum=1 161 for i in "ubuntu-18.04" "windows-2019"; do 162 for f in `ls builds/containerd-binaries-${i}`; do 163 echo "::set-output name=file${_filenum}::${f}" 164 let "_filenum+=1" 165 done 166 for f in `ls builds/cri-containerd-binaries-${i}`; do 167 echo "::set-output name=file${_filenum}::${f}" 168 let "_filenum+=1" 169 done 170 done 171 - name: Create Release 172 id: create_release 173 uses: actions/create-release@v1.1.2 174 env: 175 GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} 176 with: 177 tag_name: ${{ github.ref }} 178 release_name: containerd ${{ needs.check.outputs.stringver }} 179 body_path: ./builds/containerd-release-notes/release-notes.md 180 draft: false 181 prerelease: ${{ contains(github.ref, 'beta') || contains(github.ref, 'rc') }} 182 - name: Upload Linux containerd tarball 183 uses: actions/upload-release-asset@v1 184 env: 185 GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} 186 with: 187 upload_url: ${{ steps.create_release.outputs.upload_url }} 188 asset_path: ./builds/containerd-binaries-ubuntu-18.04/${{ steps.catalog.outputs.file1 }} 189 asset_name: ${{ steps.catalog.outputs.file1 }} 190 asset_content_type: application/gzip 191 - name: Upload Linux sha256 sum 192 uses: actions/upload-release-asset@v1 193 env: 194 GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} 195 with: 196 upload_url: ${{ steps.create_release.outputs.upload_url }} 197 asset_path: ./builds/containerd-binaries-ubuntu-18.04/${{ steps.catalog.outputs.file2 }} 198 asset_name: ${{ steps.catalog.outputs.file2 }} 199 asset_content_type: text/plain 200 - name: Upload Linux cri containerd tarball 201 uses: actions/upload-release-asset@v1 202 env: 203 GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} 204 with: 205 upload_url: ${{ steps.create_release.outputs.upload_url }} 206 asset_path: ./builds/cri-containerd-binaries-ubuntu-18.04/${{ steps.catalog.outputs.file3 }} 207 asset_name: ${{ steps.catalog.outputs.file3 }} 208 asset_content_type: application/gzip 209 - name: Upload Linux cri sha256 sum 210 uses: actions/upload-release-asset@v1 211 env: 212 GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} 213 with: 214 upload_url: ${{ steps.create_release.outputs.upload_url }} 215 asset_path: ./builds/cri-containerd-binaries-ubuntu-18.04/${{ steps.catalog.outputs.file4 }} 216 asset_name: ${{ steps.catalog.outputs.file4 }} 217 asset_content_type: text/plain 218 - name: Upload Windows containerd tarball 219 uses: actions/upload-release-asset@v1 220 env: 221 GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} 222 with: 223 upload_url: ${{ steps.create_release.outputs.upload_url }} 224 asset_path: ./builds/containerd-binaries-windows-2019/${{ steps.catalog.outputs.file5 }} 225 asset_name: ${{ steps.catalog.outputs.file5 }} 226 asset_content_type: application/gzip 227 - name: Upload Windows sha256 sum 228 uses: actions/upload-release-asset@v1 229 env: 230 GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} 231 with: 232 upload_url: ${{ steps.create_release.outputs.upload_url }} 233 asset_path: ./builds/containerd-binaries-windows-2019/${{ steps.catalog.outputs.file6 }} 234 asset_name: ${{ steps.catalog.outputs.file6 }} 235 asset_content_type: text/plain 236 - name: Upload Windows cri containerd tarball 237 uses: actions/upload-release-asset@v1 238 env: 239 GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} 240 with: 241 upload_url: ${{ steps.create_release.outputs.upload_url }} 242 asset_path: ./builds/cri-containerd-binaries-windows-2019/${{ steps.catalog.outputs.file7 }} 243 asset_name: ${{ steps.catalog.outputs.file7 }} 244 asset_content_type: application/gzip 245 - name: Upload Windows cri sha256 sum 246 uses: actions/upload-release-asset@v1 247 env: 248 GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} 249 with: 250 upload_url: ${{ steps.create_release.outputs.upload_url }} 251 asset_path: ./builds/cri-containerd-binaries-windows-2019/${{ steps.catalog.outputs.file8 }} 252 asset_name: ${{ steps.catalog.outputs.file8 }} 253 asset_content_type: text/plain 254