Last active
September 11, 2024 15:06
-
-
Save patrickhulce/5035d49e7d86277fa73cab1350ba9928 to your computer and use it in GitHub Desktop.
GitHub Self-Hosted Runners
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
#!/bin/bash | |
# Non-scripted Tasks: | |
# - Configure device name in Preferences > Sharing | |
# - Enable Remote Login & Remote Management in Preferences > Sharing | |
# - Enable automatic login/disable password after sleep in Preferences > Security & Privacy > General | |
# - Disable screensaver/sleep in Preferences > Energy Saver | |
# - Disable spotlight indexing of home directory | |
# - Add a runner in GitHub UI to grab your token https://github.com/<org>/<repo>/settings/actions/runners/new | |
# If M1 enable Rosetta | |
softwareupdate --install-rosetta | |
# Disable spotlight indexing service | |
sudo mdutil -a -i off | |
# Install homebrew, this should also prompt to install XCode | |
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh)" | |
# Install extra taps | |
brew tap homebrew/cask | |
brew tap homebrew/cask-versions | |
brew tap homebrew/services | |
# Install utilities | |
brew update | |
brew install git git-lfs hub | |
brew install --cask docker google-chrome firefox microsoft-edge | |
git lfs install | |
# Install nvm (see https://github.com/nvm-sh/nvm#installing-and-updating) | |
touch ~/.zshrc | |
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.37.2/install.sh | bash | |
# Setup npm packages | |
nvm install v14 | |
npm install -g yarn | |
# Setup GitHub runner | |
mkdir actions-runner && cd actions-runner | |
curl -O -L https://github.com/actions/runner/releases/download/v2.287.1/actions-runner-osx-x64-2.287.1.tar.gz | |
tar xzf ./actions-runner-osx-x64-2.287.1.tar.gz | |
./config.sh --url https://github.com/XXXXX/XXXXX --token XXXX | |
./svc.sh install | |
./svc.sh start |
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
# Non-scripted tasks: | |
# - Control Panel > System and Security > System > See the name of this computer > Change... | |
# - Control Panel > System and Security > System > Allow remote access > Allow remote connections to this computer | |
# - Control Panel > System and Security > Power Options > High performance > Edit Plan Settings > "Never"/"Never" | |
# - Windows+R > netplwiz > Uncheck "Users must enter a user name and password..." > Apply | |
# - [tigervnc] Programs > TigerVNC 64-bit > VNC Server (Service Mode) > Security > Configure | |
# - [tigervnc] Control Panel > Firewall > Advanced Settings > Add Inbound Rule > Allow 5900-5910 | |
# - [tigervnc] Programs > TigerVNC 64-bit > VNC Server (Service Mode) > Start VNC Service | |
# Install chocolatey | |
Set-ExecutionPolicy Bypass -Scope Process -Force; [System.Net.ServicePointManager]::SecurityProtocol = [System.Net.ServicePointManager]::SecurityProtocol -bor 3072; iex ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1')) | |
choco install -y git git-lfs zip hub nvm nano visualstudio2019community | |
Add-Content $profile '$env:Path += ";C:\Program Files\Git\usr\bin"' # add git tools to your default path | |
# In git bash or reloaded powershell | |
git lfs install | |
nvm install 10.21.0 | |
nvm use 10.21.0 | |
npm install -g yarn jest | |
# Setup github actions runner | |
cd \ | |
mkdir actions-runner; cd actions-runner | |
Invoke-WebRequest -Uri https://github.com/actions/runner/releases/download/v2.287.1/actions-runner-win-x64-2.287.1.zip -OutFile actions-runner-win-x64-2.287.1.zip | |
Add-Type -AssemblyName System.IO.Compression.FileSystem ; [System.IO.Compression.ZipFile]::ExtractToDirectory("$PWD/actions-runner-win-x64-2.287.1.zip", "$PWD") | |
./config.cmd --url https://github.com/XXXXX/XXXXX --token XXXX # Answer Y to do you want to configure as a service, use the user account you setup to automatically login | |
Get-Service "actions.runner.*" | |
Set-ExecutionPolicy RemoteSigned # allow github actions to execute powershell commands as part of github actions | |
# Download Google Cloud SDK from | |
# Disable "app execution aliases" in settings like https://stackoverflow.com/a/57168165/1091925 says | |
# Install python | |
gcloud init | |
choco install python | |
# Logout of RDP and relogin user | |
qwinsta # find your current session ID and use it instead of 0 in next command | |
tscon 0 /dest:console |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Thanks for the scripts!
Two minor things:
https://github.com/<org>/<repo>/settings/actions/runners/new