on: push: branches: - main - "release/**" tags: - "v*" # Push events to matching v*, i.e. v1.0, v20.15.10 pull_request: branches: - main - "release/**" name: Release permissions: # added using https://github.com/step-security/secure-workflows contents: read jobs: check: name: Check Signed Tag if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v') runs-on: ubuntu-latest timeout-minutes: 5 outputs: stringver: ${{ steps.contentrel.outputs.stringver }} steps: - name: Checkout code uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 with: ref: ${{ github.ref }} path: src/github.com/containerd/containerd persist-credentials: false - name: Check signature run: | # git tag -v requires an allowedSignersFile to be configured and exist for ssh signature verification touch ${{ runner.temp }}/empty-allowedSignersFile git config --global gpg.ssh.allowedSignersFile ${{ runner.temp }}/empty-allowedSignersFile releasever=${GITHUB_REF} releasever="${releasever#refs/tags/}" TAGCHECK=$(git tag -v "${releasever}" 2>&1 >/dev/null) || echo "${TAGCHECK}" | grep -q "error" && { echo "::error::tag ${releasever} is not a signed tag. Failing release process." exit 1 } || { echo "Tag ${releasever} is signed." exit 0 } working-directory: src/github.com/containerd/containerd - name: Release content id: contentrel run: | RELEASEVER=${GITHUB_REF} echo "stringver=${RELEASEVER#refs/tags/v}" >> $GITHUB_OUTPUT git tag -l "${RELEASEVER#refs/tags/}" -n20000 | tail -n +3 | cut -c 5- >release-notes.md working-directory: src/github.com/containerd/containerd - name: Save release notes uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1 with: name: containerd-release-notes path: src/github.com/containerd/containerd/release-notes.md build: name: Build Release Binaries runs-on: ubuntu-latest timeout-minutes: 30 strategy: matrix: include: - dockerfile-ubuntu: 22.04 dockerfile-platform: linux/amd64 - dockerfile-ubuntu: 22.04 dockerfile-platform: linux/arm64 - dockerfile-ubuntu: 22.04 dockerfile-platform: linux/ppc64le - dockerfile-ubuntu: 22.04 dockerfile-platform: linux/s390x - dockerfile-ubuntu: 22.04 dockerfile-platform: linux/riscv64 - dockerfile-ubuntu: 22.04 dockerfile-platform: windows/amd64 steps: - name: Set RELEASE_VER if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v') shell: bash run: | releasever=${GITHUB_REF} releasever="${releasever#refs/tags/}" echo "RELEASE_VER=${releasever}" >> $GITHUB_ENV - name: Checkout containerd uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 with: # Intentionally use github.repository instead of containerd/containerd to # make this action runnable on forks. # See https://github.com/containerd/containerd/issues/5098 for the context. repository: ${{ github.repository }} ref: ${{ github.ref }} path: src/github.com/containerd/containerd persist-credentials: false - name: Setup buildx instance uses: docker/setup-buildx-action@bb05f3f5519dd87d3ba754cc423b652a5edd6d2c # v4.2.0 with: use: true - uses: crazy-max/ghaction-github-runtime@04d248b84655b509d8c44dc1d6f990c879747487 # v4.0.0 - name: Make shell: bash run: | cache="--cache-from=type=gha,scope=containerd-release --cache-to=type=gha,scope=containerd-release" if [[ "${PLATFORM}" =~ "windows" ]]; then # For Windows the cni build script generates a config but shells out to powershell (and also assume it is running on windows) to get a gateway and subnet. # The values provided here are taken from packages that we previously generated. export GATEWAY=172.21.16.1 export PREFIX_LEN=12 BUILD_ARGS="--build-arg GATEWAY --build-arg PREFIX_LEN" fi docker buildx build ${cache} --build-arg RELEASE_VER --build-arg UBUNTU_VERSION=${{ matrix.dockerfile-ubuntu }} ${BUILD_ARGS} -f .github/workflows/release/Dockerfile --platform=${PLATFORM} -o releases/ . echo PLATFORM_CLEAN=${PLATFORM/\//-} >> $GITHUB_ENV # Remove symlinks since we don't want these in the release Artifacts (if any) find ./releases/ -maxdepth 1 -type l | xargs rm -f working-directory: src/github.com/containerd/containerd env: PLATFORM: ${{ matrix.dockerfile-platform }} - name: Save Artifacts uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1 with: name: release-tars-${{env.PLATFORM_CLEAN}} path: src/github.com/containerd/containerd/releases/*.tar.gz* release: name: Create containerd Release if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v') permissions: contents: write id-token: write attestations: write runs-on: ubuntu-latest timeout-minutes: 10 needs: [build, check] steps: - name: Download builds and release notes uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1 with: path: builds - name: Attest Artifacts id: attest uses: actions/attest-build-provenance@4d101475d8b20a2381f78447822ac1eab6504dd8 # v4.2.2 with: subject-path: ./builds/release-tars-**/*.tar.gz - name: Rename attestation artifact run: mv ${{ steps.attest.outputs.bundle-path }} containerd-${{ needs.check.outputs.stringver }}-attestation.intoto.jsonl - name: Create Release uses: softprops/action-gh-release@718ea10b132b3b2eba29c1007bb80653f286566b # v3.0.1 with: token: ${{ secrets.GITHUB_TOKEN }} fail_on_unmatched_files: true name: containerd ${{ needs.check.outputs.stringver }} draft: false prerelease: ${{ contains(github.ref, 'beta') || contains(github.ref, 'rc') }} body_path: ./builds/containerd-release-notes/release-notes.md files: | builds/release-tars-**/* containerd-*-attestation.intoto.jsonl make_latest: true