From 7de576148a835af0d9cf7cdad97118a5c24e7d9b Mon Sep 17 00:00:00 2001 From: Dan Van Atta Date: Tue, 23 Jul 2024 13:28:08 -0700 Subject: [PATCH] Bot build: add workflow to publish docker container of headless-game-runner (bot) (#12756) * Bot build: add workflow to publish docker container of headless-game-runner (bot) * Don't run on pull request --- .github/workflows/build-headless-docker.yml | 33 +++++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 .github/workflows/build-headless-docker.yml diff --git a/.github/workflows/build-headless-docker.yml b/.github/workflows/build-headless-docker.yml new file mode 100644 index 0000000000..e45f3c2441 --- /dev/null +++ b/.github/workflows/build-headless-docker.yml @@ -0,0 +1,33 @@ +# Runs when master branch is updated. +# Creates & pushes a docker container for bots. + +name: Master Branch Build - Build Bot Docker Container +on: + push: + branches: + - master +jobs: + build: + env: + IS_MASTER_BUILD: ${{ github.event_name == 'push' && github.ref == 'refs/heads/master' }} + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - name: Set up JDK 11 + uses: actions/setup-java@v4 + with: + distribution: temurin + java-version: 11 + - name: Login to GitHub Container Registry + if: ${{ env.IS_MASTER_BUILD }} + uses: docker/login-action@v1 + with: + registry: ghcr.io + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + - name: build headless docker container + if: ${{ env.IS_MASTER_BUILD }} + run: | + ./gradlew :game-app:game-headless:shadowJar + docker build game-app/game-headless --tag ghcr.io/triplea-game/bot:latest + docker push ghcr.io/triplea-game/bot:latest