forked from douglascamata/setup-docker-macos-action
-
Notifications
You must be signed in to change notification settings - Fork 0
/
action.yml
70 lines (70 loc) · 2.39 KB
/
action.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
name: "Setup Docker on macOS"
description: "Setup Docker on macOS using Colima, Lima-VM, and Homebrew."
outputs:
colima-version:
value: ${{ steps.colima-version.outputs.version }}
description: Version of Colima
docker-client-version:
value: ${{ steps.docker-client-version.outputs.version }}
description: Version of the Docker client
runs:
using: "composite"
steps:
- name: Safety check
if: runner.os != 'macOS'
run: |
echo "Not a macOS runner, exiting."
exit 1
shell: bash
- name: Update Homebrew
run: |
brew update --preinstall
brew_repository="$(brew --repository)"
cat "$brew_repository/Library/Taps/homebrew/homebrew-core/Formula/colima.rb" > .github/brew-colima
cat "$brew_repository/Library/Taps/homebrew/homebrew-core/Formula/docker.rb" > .github/brew-docker
shell: bash
- name: Pre-cache
run: echo "BREW_CELLAR=$(brew --cellar)" >> $GITHUB_ENV
shell: bash
- name: Configure Homebrew cache
id: homebrew-cache
uses: actions/cache@v3.0.6
with:
path: |
${{ env.BREW_CELLAR }}/colima
${{ env.BREW_CELLAR }}/docker
${{ env.BREW_CELLAR }}/qemu
key: brew-${{ hashFiles('.github/brew-*') }}
restore-keys: brew-${{ hashFiles('.github/brew-*') }}
- name: Relink Docker client, QEMU and Colima
if: ${{ steps.homebrew-cache.outputs.cache-hit == 'true' }}
run: |
brew unlink docker colima qemu
brew link docker colima qemu
shell: bash
- name: Install Docker client and Colima
if: ${{ steps.homebrew-cache.outputs.cache-hit != 'true' }}
env:
HOMEBREW_NO_AUTO_UPDATE: "1"
HOMEBREW_NO_INSTALLED_DEPENDENTS_CHECK: "1"
run: brew install -f docker colima
shell: bash
- name: Start Colima
run: colima start
shell: bash
- id: docker-client-version
run: |
content="$(docker version)"
content="${content//'%'/'%25'}"
content="${content//$'\n'/'%0A'}"
content="${content//$'\r'/'%0D'}"
echo "::set-output name=version::$content"
shell: bash
- id: colima-version
run: |
content="$(colima version)"
content="${content//'%'/'%25'}"
content="${content//$'\n'/'%0A'}"
content="${content//$'\r'/'%0D'}"
echo "::set-output name=version::$content"
shell: bash