diff --git a/.github/workflows/runner-deploy.yml b/.github/workflows/runner-deploy.yml new file mode 100644 index 0000000..500c6ad --- /dev/null +++ b/.github/workflows/runner-deploy.yml @@ -0,0 +1,30 @@ +name: Deploy Gitea Runner +on: + workflow_dispatch: + +jobs: + deploy-runner: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v5 + - uses: superfly/flyctl-actions/setup-flyctl@master + + - name: Create runner app and volume if not exists + run: | + flyctl apps create ${{ secrets.RUNNER_APP_NAME }} || echo "Runner app exists" + flyctl volumes create runner_data --size 1 -a ${{ secrets.RUNNER_APP_NAME }} || echo "Runner volume exists" + env: + FLY_API_TOKEN: ${{ secrets.FLY_API_TOKEN }} + + - name: Register runner token + run: | + flyctl secrets set \ + GITEA_RUNNER_REGISTRATION_TOKEN=${{ secrets.GITEA_RUNNER_REGISTRATION_TOKEN }} \ + -a ${{ secrets.RUNNER_APP_NAME }} + env: + FLY_API_TOKEN: ${{ secrets.FLY_API_TOKEN }} + + - name: Deploy runner + run: flyctl deploy --remote-only -a ${{ secrets.RUNNER_APP_NAME }} --config runner/fly.toml + env: + FLY_API_TOKEN: ${{ secrets.FLY_API_TOKEN }}