Merge pull request #10 from mook-as/bump/bake-action #118
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: Build binaries and create a draft release | |
on: | |
push: | |
tags: ['*'] | |
workflow_dispatch: | |
inputs: | |
TAG: | |
description: Docker CLI tag to build | |
required: true | |
default: v25.0.1 | |
defaults: | |
run: | |
shell: bash | |
jobs: | |
build: | |
strategy: | |
fail-fast: false | |
runs-on: ubuntu-latest | |
defaults: | |
run: | |
working-directory: cli | |
steps: | |
- name: Set Docker CLI tag from tag | |
if: startsWith(github.event.ref, 'refs/tags/') | |
run: | | |
DOCKER_CLI_REF="${{ github.event.ref }}" | |
echo "DOCKER_CLI_REF=${DOCKER_CLI_REF#refs/tags/}" >> "${GITHUB_ENV}" | |
working-directory: . | |
- name: Set Docker CLI tag from inputs | |
if: github.event_name == 'workflow_dispatch' | |
run: echo "DOCKER_CLI_REF=${{ inputs.TAG }}" >> "${GITHUB_ENV}" | |
working-directory: . | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v3 | |
- name: Check out build scripts | |
uses: actions/checkout@v4 | |
with: | |
persist-credentials: false | |
path: rancher-desktop-docker-cli | |
- name: Check out docker/cli | |
uses: actions/checkout@v4 | |
with: | |
repository: docker/cli | |
ref: ${{ env.DOCKER_CLI_REF }} | |
persist-credentials: false | |
path: cli | |
# Override the build version (ignoring commits from our patches). | |
# The assignment is from https://github.com/docker/cli/blob/e57b5f78/scripts/build/.variables#L7 | |
- name: Override CLI Version | |
run: | | |
VERSION=${VERSION:-$(git describe --match 'v[0-9]*' --dirty='.m' --always --tags 2>/dev/null)} | |
if [ -n "$VERSION" ] ; then | |
echo "VERSION=${VERSION#v}-rd" >> $GITHUB_ENV | |
fi | |
- name: Apply patches | |
run: | | |
set -o errexit | |
for patch in $(ls -1 ${GITHUB_WORKSPACE}/rancher-desktop-docker-cli/patches/*) ; do | |
git am "${patch}" | |
done | |
env: | |
GIT_AUTHOR_NAME: Rancher Desktop CI Automation | |
GIT_AUTHOR_EMAIL: [email protected] | |
GIT_COMMITTER_NAME: Rancher Desktop CI Automation | |
GIT_COMMITTER_EMAIL: [email protected] | |
- name: Build darwin amd64 | |
uses: docker/[email protected] | |
with: | |
set: binary.platform=darwin/amd64 | |
workdir: cli | |
- name: Build darwin arm64 | |
uses: docker/[email protected] | |
with: | |
set: binary.platform=darwin/arm64 | |
workdir: cli | |
- name: Build WSL amd64 | |
uses: docker/[email protected] | |
with: | |
set: | | |
binary.platform=linux/amd64 | |
binary.args.GO_LDFLAGS=-X github.com/docker/cli/cli/config/credentials.LinuxCredentialsStoreDefaultOverride=wincred.exe | |
workdir: cli | |
- run: mv ./build/docker-linux-amd64 ./build/docker-wsl-amd64 | |
- name: Build WSL arm64 | |
uses: docker/[email protected] | |
with: | |
set: | | |
binary.platform=linux/arm64 | |
binary.args.GO_LDFLAGS=-X github.com/docker/cli/cli/config/credentials.LinuxCredentialsStoreDefaultOverride=wincred.exe | |
workdir: cli | |
- run: mv ./build/docker-linux-arm64 ./build/docker-wsl-arm64 | |
- name: Build linux amd64 | |
uses: docker/[email protected] | |
with: | |
set: binary.platform=linux/amd64 | |
workdir: cli | |
- name: Build linux arm64 | |
uses: docker/[email protected] | |
with: | |
set: binary.platform=linux/arm64 | |
workdir: cli | |
- name: Build windows amd64 | |
uses: docker/[email protected] | |
with: | |
set: binary.platform=windows/amd64 | |
workdir: cli | |
- name: Build windows arm64 | |
uses: docker/[email protected] | |
with: | |
set: binary.platform=windows/arm64 | |
workdir: cli | |
- name: Calculate Checksums | |
working-directory: cli/build | |
run: sha256sum docker-* > sha256sum.txt | |
- uses: actions/upload-artifact@v4 | |
name: Upload Darwin amd64 artifact | |
with: | |
name: docker-darwin-amd64 | |
path: cli/build/docker-darwin-amd64 | |
if-no-files-found: error | |
- uses: actions/upload-artifact@v4 | |
name: Upload Darwin arm64 artifact | |
with: | |
name: docker-darwin-arm64 | |
path: cli/build/docker-darwin-arm64 | |
if-no-files-found: error | |
- uses: actions/upload-artifact@v4 | |
name: Upload Linux amd64 artifact | |
with: | |
name: docker-linux-amd64 | |
path: cli/build/docker-linux-amd64 | |
if-no-files-found: error | |
- uses: actions/upload-artifact@v4 | |
name: Upload Linux arm64 artifact | |
with: | |
name: docker-linux-arm64 | |
path: cli/build/docker-linux-arm64 | |
if-no-files-found: error | |
- uses: actions/upload-artifact@v4 | |
name: Upload Windows amd64 artifact | |
with: | |
name: docker-windows-amd64 | |
path: cli/build/docker-windows-amd64.exe | |
if-no-files-found: error | |
- uses: actions/upload-artifact@v4 | |
name: Upload WSL amd64 artifact | |
with: | |
name: docker-wsl-amd64 | |
path: cli/build/docker-wsl-amd64 | |
if-no-files-found: error | |
- uses: actions/upload-artifact@v4 | |
name: Upload Windows arm64 artifact | |
with: | |
name: docker-windows-arm64 | |
path: cli/build/docker-windows-arm64.exe | |
if-no-files-found: error | |
- uses: actions/upload-artifact@v4 | |
name: Upload WSL arm64 artifact | |
with: | |
name: docker-wsl-arm64 | |
path: cli/build/docker-wsl-arm64 | |
if-no-files-found: error | |
- uses: actions/upload-artifact@v4 | |
name: Upload checksums | |
with: | |
name: sha256sum.txt | |
path: cli/build/sha256sum.txt | |
if-no-files-found: error | |
- name: Create draft release | |
if: startsWith(github.event.ref, 'refs/tags/') | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
run: >- | |
gh release create | |
"${DOCKER_CLI_REF}" | |
./build/docker-* | |
./build/sha256sum.txt | |
--draft | |
--title "Docker CLI builds for docker ${{ github.ref_name }}" | |
--notes "Docker CLI builds for docker ${{ github.ref_name }}" | |
--repo "${{ github.repository }}" |