I was testing out something.
We can use GH actions to run preview app environments.
WARNING: this is suited for self-hosted runners only! You risk a high charge
Assume you have a self-hosted runner available at:
And a pseudo workflow:
name: Launch Apps on: pull_request: branches: ["*"] jobs: launch-app: runs-on: [self-hosted, linux] container: image: node:13 ports: - 25666:25666 options: --cpus 0 steps: - uses: actions/checkout@v2 - name: Run docs run: cd docs && npx serve -l 25666
Our docs page will be accessible at:
The app will be available until a timeout of six hours.
- If we don’t assign a static port, docker will randomize it and we extract it and post a link to a PR. We can run many review apps on powerful machine
- We can many GH action runners on a single powerful machine
- Native GH action containers will automatically garbage collect
- We will need a cleanup script for previous workflow runs
- We can use
docker runto run arbitrary image but we will need smarter cleanup scripts