Skip to content

Interactive SSH Access #3

Interactive SSH Access

Interactive SSH Access #3

Workflow file for this run

name: Interactive SSH Access
on:
workflow_dispatch:
jobs:
setup-ssh:
runs-on: macos-12
steps:
- name: Checkout repository
uses: actions/checkout@v2
- name: Set up Docker
run: |
brew install --cask docker
open /Applications/Docker.app
env:
DISPLAY: :0
- name: Install SSH server
run: |
brew install openssh
sudo systemsetup -f -setremotelogin on
- name: Start SSH server
run: sudo launchctl load -w /System/Library/LaunchDaemons/ssh.plist
- name: Generate SSH key
id: ssh-key
run: |
ssh-keygen -t rsa -b 4096 -f $HOME/.ssh/id_rsa -N ""
cat $HOME/.ssh/id_rsa.pub >> $HOME/.ssh/authorized_keys
echo "Private key for SSH access:"
cat $HOME/.ssh/id_rsa
- name: Display SSH connection info
run: |
echo "Use the following command to connect to the runner via SSH:"
echo "ssh -i $HOME/.ssh/id_rsa $(whoami)@$(hostname)"
- name: Keep runner alive for 30 minutes
run: |
echo "Runner will stay alive for 30 minutes. Connect using SSH."
sleep 1800