diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..b045b46 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,64 @@ +name: CI + +on: + pull_request: + paths: + - "Dockerfile" + - "docker/**" + - ".github/workflows/ci.yml" + - ".github/workflows/publish.yml" + +permissions: + contents: read + +env: + REGISTRY: ghcr.io + IMAGE_NAME: ${{ github.repository }} + +jobs: + build: + runs-on: ubuntu-latest + timeout-minutes: 360 + strategy: + fail-fast: false + matrix: + include: + - tag: playerbots + build_playerbots: "ON" + - tag: no-bots + build_playerbots: "OFF" + + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + + - name: Docker metadata + id: meta + uses: docker/metadata-action@v5 + with: + images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} + tags: | + type=raw,value=${{ matrix.tag }} + type=sha,prefix=${{ matrix.tag }}- + + - name: Build + uses: docker/build-push-action@v6 + with: + context: . + file: ./Dockerfile + push: false + tags: ${{ steps.meta.outputs.tags }} + labels: ${{ steps.meta.outputs.labels }} + build-args: | + BUILD_PLAYERBOTS=${{ matrix.build_playerbots }} + USE_EXTRACTORS=OFF + SOURCE_REPO=https://github.com/Shyalya/tortoise-wow.git + SOURCE_REF=playerbots-integration-gh + CMAKE_BUILD_TYPE=Release + CMAKE_INSTALL_PREFIX=/opt/turtle + cache-from: type=gha,scope=${{ matrix.tag }} + cache-to: type=gha,mode=max,scope=${{ matrix.tag }} + provenance: false diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 4e24cf2..5a70b1b 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -6,11 +6,6 @@ on: paths-ignore: - "**.md" - ".env.example" - pull_request: - paths: - - "Dockerfile" - - "docker/**" - - ".github/workflows/publish.yml" schedule: # 00:00 UTC - cron: "0 0 * * *" @@ -52,7 +47,6 @@ jobs: uses: docker/setup-buildx-action@v3 - name: Log in to GHCR - if: github.event_name != 'pull_request' uses: docker/login-action@v3 with: registry: ${{ env.REGISTRY }} @@ -67,14 +61,14 @@ jobs: tags: | type=raw,value=${{ matrix.tag }} type=sha,prefix=${{ matrix.tag }}- - type=raw,value=latest,enable=${{ matrix.is_latest && github.event_name != 'pull_request' && (github.ref == 'refs/heads/main' || github.ref == 'refs/heads/master') }} + type=raw,value=latest,enable=${{ matrix.is_latest && (github.ref == 'refs/heads/main' || github.ref == 'refs/heads/master') }} - name: Build and push uses: docker/build-push-action@v6 with: context: . file: ./Dockerfile - push: ${{ github.event_name != 'pull_request' }} + push: true tags: ${{ steps.meta.outputs.tags }} labels: ${{ steps.meta.outputs.labels }} build-args: |