Skip to content

Commit 55627e3

Browse files
authored
Merge pull request #4 from AkihiroSuda/fix-3
Merge `ssh` action into `setup` action
2 parents 03b96d6 + 2b759ad commit 55627e3

File tree

3 files changed

+28
-29
lines changed

3 files changed

+28
-29
lines changed

README.md

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,6 @@ steps:
1818

1919
- run: limactl start --plain --name=default --cpus=1 --memory=1 template://fedora
2020

21-
- uses: lima-vm/lima-actions/ssh@v1
22-
2321
- run: rsync -a -e ssh . lima-default:/tmp/repo
2422

2523
- run: ssh lima-default ls -l /tmp/repo
@@ -29,6 +27,4 @@ steps:
2927
### `lima-vm/lima-actions/setup`
3028
- `version` (string): Lima version. e.g., "latest", "v1.0.6". Defaults to "latest".
3129
- `additional_guestagents` (boolean): Install lima-additional-guestagents. Usually not needed. Defaults to `false`.
32-
33-
### `lima-vm/lima-actions/ssh`
34-
None
30+
- `ssh` (boolean): Setup `~/.ssh/config`. Defaults to `true`. Previously, this was a separate action `lima-vm/lima-actions/setup-ssh@v1`.

setup/action.yml

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,10 @@ inputs:
1111
type: boolean
1212
default: false
1313
description: "Install lima-additional-guestagents. Usually not needed."
14+
ssh:
15+
type: boolean
16+
default: true
17+
description: "Enable SSH support. Previously, this was a separate action `lima-vm/lima-actions/setup-ssh@v1`."
1418
outputs:
1519
version:
1620
description: "Resolved Lima version."
@@ -62,3 +66,22 @@ runs:
6266
gh attestation verify --owner=lima-vm "${FILE}"
6367
sudo tar Cxzf /usr/local "${FILE}"
6468
rm -f "${FILE}"
69+
- name: "Set up SSH"
70+
id: setup-ssh
71+
# fromJSON is needed here for booleans
72+
if: ${{ fromJSON(inputs.ssh) }}
73+
shell: bash
74+
run: |
75+
set -eux -o pipefail
76+
mkdir -p -m 0700 ~/.ssh
77+
cd ~/.ssh
78+
(
79+
if [ -e config ]; then
80+
# "Include" must be in the top section of the config
81+
echo 'Include ~/.lima/*/ssh.config' > config.tmp
82+
cat config >> config.tmp
83+
mv config.tmp config
84+
else
85+
echo 'Include ~/.lima/*/ssh.config' > config
86+
fi
87+
)

ssh/action.yml

Lines changed: 4 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,12 @@
11
# SPDX-FileCopyrightText: Copyright The Lima Authors
22
# SPDX-License-Identifier: Apache-2.0
33

4-
name: "Set up SSH"
5-
description: "Set up SSH"
4+
name: "Set up SSH (Deprecated, as the feature is merged into `setup` action)"
5+
description: "Set up SSH (Deprecated, as the feature is merged into `setup` action)"
66
runs:
77
using: "composite"
88
steps:
9-
- name: "Set up SSH"
9+
- name: "NOP"
1010
id: setup-ssh
1111
shell: bash
12-
run: |
13-
set -eux -o pipefail
14-
mkdir -p -m 0700 ~/.ssh
15-
(
16-
cd ~/.lima
17-
for f in $(ls | grep -v ^_); do
18-
config="$(pwd)/${f}/ssh.config"
19-
[ -e "${config}" ] && echo "Include ${config}" >> ~/.ssh/config.tmp
20-
done
21-
)
22-
(
23-
cd ~/.ssh
24-
if [ -e config ]; then
25-
# "Include" must be in the top section of the config
26-
cat config.tmp config > config.tmp2
27-
mv config.tmp2 config
28-
else
29-
mv config.tmp config
30-
fi
31-
rm -f config.tmp*
32-
)
12+
run: echo "::warning::lima-vm/lima-actions/ssh is deprecated, as the feature is merged into lima-vm/lima-actions/setup."

0 commit comments

Comments
 (0)