Github Actions self-hosted runners
집에 있는 desktop 에서 프로그램 이것저것 실행하고 있어요.
코드 변경사항 있을 때 마다 빌드하고 배포하는 게 번거로워서 desktop 에 self-hosted runner 를 설치하기로 해요.
하나의 runner 로 여러 repository 에서 사용할 수 있을 줄 알았는데 각 repository 마다 새로운 runner 를 만들어야 하는 것 같아요.
근데 organization 은 self-hosted runner 설정을 해두면 runner 를 여러 repository 에서 공유할 수 있다고 하네요.
organization 을 하나 만들고 여기에 runner 가 필요한 repository 들을 넣어서 쓰기로 해요.
진행
desktop (Ubuntu 22.04) 에 설치하기에 문제없는 것 같아요.
- https://docs.github.com/en/actions/hosting-your-own-runners/managing-self-hosted-runners/about-self-hosted-runners#linux
문서 따라 진행하니 잘 설치됐어요.
- https://docs.github.com/en/actions/hosting-your-own-runners
.github/workflows 에 원하는 workflow 를 .yml 파일에 작성해요.
- https://docs.github.com/en/actions/using-workflows/about-workflows
name: Desktop route-kingsubin workflow
on:
push:
branches: [ "main" ]
jobs:
build:
runs-on: self-hosted
steps:
- uses: actions/checkout@v3
- name: Build the Docker image
run: "~/bin/build-route-kingsubin"
stop:
needs: build
runs-on: self-hosted
steps:
- name: Stop the Docker image
run: "~/bin/stop-route-kingsubin"
run:
needs: stop
runs-on: self-hosted
steps:
- name: Run the Docker image
run: "~/bin/start-route-kingsubin"
조건으로 걸어둔 main branch 에 push 해서 돌아가는지 확인해 보니 잘 돌아가네요.
actions 문서에 이것저것 많은 것 같은데 요즘에는 cloud build 를 써서 볼 일이 없네요.
desktop 에서도 지금은 trigger 걸어둘 만한 프로젝트가 하나뿐인데 organization 도 만들었으니 뭐라도 더 올려야겠어요.
