do not mirror on localhost #81
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: buildkit | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.ref }} | |
cancel-in-progress: true | |
on: | |
workflow_dispatch: | |
push: | |
branches: | |
- 'master' | |
- 'v[0-9]+.[0-9]+' | |
tags: | |
- 'v*' | |
pull_request: | |
paths-ignore: | |
- 'README.md' | |
- 'docs/**' | |
- 'frontend/dockerfile/docs/**' | |
env: | |
GO_VERSION: "1.20" | |
SETUP_BUILDX_VERSION: "latest" | |
SETUP_BUILDKIT_IMAGE: "moby/buildkit:latest" | |
IMAGE_NAME: "ghcr.io/gitpod-io/buildkit" | |
PLATFORMS: "linux/amd64" | |
DESTDIR: "./bin" | |
jobs: | |
prepare: | |
runs-on: ubuntu-22.04 | |
outputs: | |
tag: ${{ steps.prep.outputs.tag }} | |
push: ${{ steps.prep.outputs.push }} | |
platforms: ${{ steps.prep.outputs.platforms }} | |
steps: | |
- | |
name: Checkout | |
uses: actions/checkout@v3 | |
- | |
name: Prepare | |
id: prep | |
run: | | |
TAG=pr | |
PUSH=false | |
if [ "${{ github.event_name }}" = "schedule" ]; then | |
TAG=nightly | |
PUSH=push | |
elif [[ $GITHUB_REF == refs/tags/v* ]]; then | |
TAG=${GITHUB_REF#refs/tags/} | |
PUSH=push | |
elif [[ $GITHUB_REF == refs/heads/* ]]; then | |
TAG=$(echo ${GITHUB_REF#refs/heads/} | sed -r 's#/+#-#g') | |
if [ $GITHUB_REF = "refs/heads/${{ github.event.repository.default_branch }}" ]; then | |
PUSH=push | |
fi | |
fi | |
if [ "$GITHUB_REPOSITORY" != "moby/buildkit" ]; then | |
PUSH=false | |
fi | |
echo "tag=${TAG}" >>${GITHUB_OUTPUT} | |
echo "push=${PUSH}" >>${GITHUB_OUTPUT} | |
echo ::set-output name=platforms::'["linux/amd64"]' | |
binaries: | |
runs-on: ubuntu-22.04 | |
needs: | |
- prepare | |
strategy: | |
fail-fast: false | |
matrix: | |
platform: ${{ fromJson(needs.prepare.outputs.platforms) }} | |
steps: | |
- | |
name: Prepare | |
run: | | |
platform=${{ matrix.platform }} | |
echo "PLATFORM_PAIR=${platform//\//-}" >> $GITHUB_ENV | |
- | |
name: Checkout | |
uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
- | |
name: Expose GitHub Runtime | |
uses: crazy-max/ghaction-github-runtime@v2 | |
- | |
name: Set up QEMU | |
uses: docker/setup-qemu-action@v2 | |
- | |
name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v2 | |
with: | |
version: ${{ env.SETUP_BUILDX_VERSION }} | |
driver-opts: image=${{ env.SETUP_BUILDKIT_IMAGE }} | |
buildkitd-flags: --debug | |
- | |
name: Build | |
run: | | |
make release | |
env: | |
RELEASE: ${{ startsWith(github.ref, 'refs/tags/v') }} | |
PLATFORMS: ${{ matrix.platform }} | |
CACHE_FROM: type=gha,scope=binaries-${{ env.PLATFORM_PAIR }} | |
CACHE_TO: type=gha,scope=binaries-${{ env.PLATFORM_PAIR }} | |
- | |
name: Upload artifacts | |
uses: actions/upload-artifact@v3 | |
with: | |
name: buildkit | |
path: ${{ env.DESTDIR }}/* | |
if-no-files-found: error | |
image: | |
runs-on: ubuntu-22.04 | |
needs: | |
- prepare | |
strategy: | |
fail-fast: false | |
matrix: | |
target-stage: | |
- '' | |
steps: | |
- | |
name: Checkout | |
uses: actions/checkout@v3 | |
- | |
name: Expose GitHub Runtime | |
uses: crazy-max/ghaction-github-runtime@v2 | |
- | |
name: Set up QEMU | |
uses: docker/setup-qemu-action@v2 | |
- | |
name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v2 | |
with: | |
version: ${{ env.SETUP_BUILDX_VERSION }} | |
driver-opts: image=${{ env.SETUP_BUILDKIT_IMAGE }} | |
buildkitd-flags: --debug | |
- | |
name: Login to GitHub Container Registry | |
if: needs.prepare.outputs.push == 'push' | |
uses: docker/login-action@v2 | |
with: | |
registry: ghcr.io | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- | |
name: Build ${{ needs.prepare.outputs.tag }} | |
run: | | |
./hack/images "${{ needs.prepare.outputs.tag }}" "$IMAGE_NAME" "${{ needs.prepare.outputs.push }}" | |
env: | |
RELEASE: ${{ startsWith(github.ref, 'refs/tags/v') }} | |
TARGET: ${{ matrix.target-stage }} | |
CACHE_FROM: type=gha,scope=image${{ matrix.target-stage }} | |
CACHE_TO: type=gha,scope=image${{ matrix.target-stage }} | |
release: | |
runs-on: ubuntu-22.04 | |
needs: | |
- prepare | |
- binaries | |
- image | |
steps: | |
- | |
name: Download artifacts | |
uses: actions/download-artifact@v3 | |
with: | |
name: buildkit | |
path: ${{ env.DESTDIR }} | |
- | |
name: List artifacts | |
run: | | |
tree -nh ${{ env.DESTDIR }} | |
- | |
name: GitHub Release | |
if: startsWith(github.ref, 'refs/tags/v') | |
uses: softprops/action-gh-release@de2c0eb89ae2a093876385947365aca7b0e5f844 # v0.1.15 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
draft: true | |
files: ${{ env.DESTDIR }}/* | |
name: ${{ needs.prepare.outputs.tag }} |