|
| 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/} -n1000 | 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.13.11' |
| 66 | + |
| 67 | + - name: Set env |
| 68 | + shell: bash |
| 69 | + run: | |
| 70 | + releasever=${{ github.ref }} |
| 71 | + releasever="${releasever#refs/tags/}" |
| 72 | + echo "::set-env name=RELEASE_VER::${releasever}" |
| 73 | + echo "::set-env name=GOPATH::${{ github.workspace }}" |
| 74 | + echo "::add-path::${{ github.workspace }}/bin" |
| 75 | +
|
| 76 | + - name: Checkout |
| 77 | + uses: actions/checkout@v2 |
| 78 | + with: |
| 79 | + repository: containerd/containerd |
| 80 | + ref: ${{ github.ref }} |
| 81 | + path: src/github.com/containerd/containerd |
| 82 | + |
| 83 | + - name: Install Linux dependencies |
| 84 | + if: startsWith(matrix.os, 'ubuntu') |
| 85 | + run: | |
| 86 | + sudo apt-get install -y btrfs-tools libseccomp-dev |
| 87 | +
|
| 88 | + - name: Make |
| 89 | + shell: bash |
| 90 | + env: |
| 91 | + MOS: ${{ matrix.os }} |
| 92 | + OS: linux |
| 93 | + run: | |
| 94 | + make build |
| 95 | + make binaries |
| 96 | + [[ "${MOS}" =~ "windows" ]] && { |
| 97 | + OS=windows |
| 98 | + } |
| 99 | + TARFILE="containerd-${RELEASE_VER#v}-${OS}-amd64.tar.gz" |
| 100 | + tar czf ${TARFILE} bin/ |
| 101 | + sha256sum ${TARFILE} >${TARFILE}.sha256sum |
| 102 | + working-directory: src/github.com/containerd/containerd |
| 103 | + |
| 104 | + - name: Save build binaries |
| 105 | + uses: actions/upload-artifact@v2 |
| 106 | + with: |
| 107 | + name: containerd-binaries-${{ matrix.os }} |
| 108 | + path: src/github.com/containerd/containerd/*.tar.gz* |
| 109 | + |
| 110 | + release: |
| 111 | + name: Create containerd Release |
| 112 | + runs-on: ubuntu-18.04 |
| 113 | + timeout-minutes: 10 |
| 114 | + needs: [build, check] |
| 115 | + |
| 116 | + steps: |
| 117 | + - name: Download builds and release notes |
| 118 | + uses: actions/download-artifact@v2 |
| 119 | + with: |
| 120 | + path: builds |
| 121 | + - name: Catalog build assets for upload |
| 122 | + id: catalog |
| 123 | + run: | |
| 124 | + _filenum=1 |
| 125 | + for i in "ubuntu-18.04" "windows-2019"; do |
| 126 | + for i in `ls builds/containerd-binaries-${i}`; do |
| 127 | + echo "::set-output name=file${_filenum}::${i}" |
| 128 | + let "_filenum+=1" |
| 129 | + done |
| 130 | + done |
| 131 | + - name: Create Release |
| 132 | + id: create_release |
| 133 | + uses: jbolda/create-release@v1.1.0 |
| 134 | + env: |
| 135 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 136 | + with: |
| 137 | + tag_name: ${{ github.ref }} |
| 138 | + release_name: containerd ${{ needs.check.outputs.stringver }} |
| 139 | + bodyFromFile: ./builds/containerd-release-notes/release-notes.md |
| 140 | + draft: false |
| 141 | + prerelease: ${{ contains(github.ref, 'beta') || contains(github.ref, 'rc') }} |
| 142 | + - name: Upload Linux containerd tarball |
| 143 | + uses: actions/upload-release-asset@v1 |
| 144 | + env: |
| 145 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 146 | + with: |
| 147 | + upload_url: ${{ steps.create_release.outputs.upload_url }} |
| 148 | + asset_path: ./builds/containerd-binaries-ubuntu-18.04/${{ steps.catalog.outputs.file1 }} |
| 149 | + asset_name: ${{ steps.catalog.outputs.file1 }} |
| 150 | + asset_content_type: application/gzip |
| 151 | + - name: Upload Linux sha256 sum |
| 152 | + uses: actions/upload-release-asset@v1 |
| 153 | + env: |
| 154 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 155 | + with: |
| 156 | + upload_url: ${{ steps.create_release.outputs.upload_url }} |
| 157 | + asset_path: ./builds/containerd-binaries-ubuntu-18.04/${{ steps.catalog.outputs.file2 }} |
| 158 | + asset_name: ${{ steps.catalog.outputs.file2 }} |
| 159 | + asset_content_type: text/plain |
| 160 | + - name: Upload Windows containerd tarball |
| 161 | + uses: actions/upload-release-asset@v1 |
| 162 | + env: |
| 163 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 164 | + with: |
| 165 | + upload_url: ${{ steps.create_release.outputs.upload_url }} |
| 166 | + asset_path: ./builds/containerd-binaries-windows-2019/${{ steps.catalog.outputs.file3 }} |
| 167 | + asset_name: ${{ steps.catalog.outputs.file3 }} |
| 168 | + asset_content_type: application/gzip |
| 169 | + - name: Upload Windows sha256 sum |
| 170 | + uses: actions/upload-release-asset@v1 |
| 171 | + env: |
| 172 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 173 | + with: |
| 174 | + upload_url: ${{ steps.create_release.outputs.upload_url }} |
| 175 | + asset_path: ./builds/containerd-binaries-windows-2019/${{ steps.catalog.outputs.file4 }} |
| 176 | + asset_name: ${{ steps.catalog.outputs.file4 }} |
| 177 | + asset_content_type: text/plain |
0 commit comments