Created
          July 12, 2021 09:15 
        
      - 
      
- 
        Save pgressa/63058f55432d432a4893ca47a94d30f7 to your computer and use it in GitHub Desktop. 
    Install self-hosted runners
  
        
  
    
      This file contains hidden or 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
    
  
  
    
  | #!/usr/bin/env bash | |
| REPOSITORY_URL=$1 | |
| TOKEN=$2 | |
| RUNNER_ID=1000 | |
| RUNNER_DIR_NAME= | |
| for i in {0..1000}; do | |
| RUNNER_DIR_NAME=runner_$i | |
| echo "Checking $RUNNER_DIR_NAME" | |
| if [[ -d "runner_$i" ]]; then | |
| echo "Runner $i exists" | |
| else | |
| echo "Found runner $i" | |
| RUNNER_ID=$i | |
| break | |
| fi | |
| done | |
| mkdir $RUNNER_DIR_NAME | |
| pushd $RUNNER_DIR_NAME | |
| curl -o actions-runner-linux-x64-2.277.1.tar.gz -L https://github.com/actions/runner/releases/download/v2.277.1/actions-runner-linux-x64-2.277.1.tar.gz | |
| tar xzf ./actions-runner-linux-x64-2.277.1.tar.gz | |
| ./config.sh --unattended --name "$(hostname)_${RUNNER_DIR_NAME}" --url $REPOSITORY_URL --token $TOKEN | |
| sudo ./svc.sh install | |
| sudo ./svc.sh start | |
| popd | 
  
    Sign up for free
    to join this conversation on GitHub.
    Already have an account?
    Sign in to comment