Skip to content

Commit

Permalink
Merge branch '3.3.5' into npcbots_3.3.5
Browse files Browse the repository at this point in the history
  • Loading branch information
trickerer committed Oct 22, 2023
2 parents 3d9c7f7 + a782298 commit de00b63
Show file tree
Hide file tree
Showing 77 changed files with 3,216 additions and 1,304 deletions.
39 changes: 39 additions & 0 deletions .github/actions/docker-tag-and-build/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
name: docker tag and build
description: a helper action to shorten generating docker tags and building
inputs:
component-name:
description: name of the component/docker image (eg worldserver, authserver)
type: string
required: true
push:
description: whether to push the image or not
type: boolean
required: true
version:
description: version tag to use for docker image
required: true
type: string
runs:
using: composite
steps:
- name: Get Docker Metadata
id: meta
uses: docker/metadata-action@v5
with:
images: acore/ac-wotlk-${{ inputs.component-name }}
tags: |
type=raw,value=${{ inputs.version }}
type=ref,event=branch
- name: Build and push
uses: docker/build-push-action@v5
with:
context: ${{ github.workspace }}
file: apps/docker/Dockerfile
push: ${{ inputs.push }}
tags: ${{ steps.meta.outputs.tags }}
target: ${{ inputs.component-name }}
build-args: |
USER_ID=1000
GROUP_ID=1000
DOCKER_USER=acore
202 changes: 97 additions & 105 deletions .github/workflows/docker_build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,174 +4,166 @@ on:
branches:
- 'master'
pull_request:
types: ['labeled', 'opened', 'synchronize', 'reopened']
types:
- labeled
- opened
- synchronize
- reopened

concurrency:
group: ${{ github.head_ref }} || concat(${{ github.ref }}, ${{ github.workflow }})
cancel-in-progress: true

jobs:
docker-build-n-deploy-dev:
strategy:
fail-fast: true
matrix:
os: [ubuntu-20.04]
runs-on: ${{ matrix.os }}
runs-on: "ubuntu-latest"
if: |
github.repository == 'azerothcore/azerothcore-wotlk'
&& !github.event.pull_request.draft
&& (github.ref == 'refs/heads/master' || contains(github.event.pull_request.labels.*.name, 'run-build') || github.event.label.name == 'run-build')
&& (github.ref_name == 'master' || contains(github.event.pull_request.labels.*.name, 'run-build') || github.event.label.name == 'run-build')
env:
COMPOSE_DOCKER_CLI_BUILD: 1
DOCKER_BUILDKIT: 1

steps:
- name: Extract branch name
shell: bash
run: echo "##[set-output name=branch;]$(echo ${GITHUB_REF#refs/heads/})"
id: extract_branch

- name: Configure
- name: Free up disk space
run: |
sudo rm -rf /usr/local/lib/android
sudo rm -rf /usr/share/dotnet
sudo rm -rf /opt/ghc
sudo rm -rf "$AGENT_TOOLSDIRECTORY"
docker --version
docker compose version
- uses: actions/checkout@v4
# we need the entire history for the ac-dev-server
# with:
# fetch-depth: 2

# - name: Set up Docker Buildx
# uses: docker/setup-buildx-action@v1

- name: Login to Docker Hub
if: github.repository == 'azerothcore/azerothcore-wotlk' && steps.extract_branch.outputs.branch == 'master'
if: github.repository == 'azerothcore/azerothcore-wotlk' && github.ref_name == 'master'
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}

- name: Build Dev
if: github.repository == 'azerothcore/azerothcore-wotlk'
env:
#DOCKER_IMAGE_TAG: ${{ steps.extract_branch.outputs.branch }}
DOCKER_CLIENT_TIMEOUT: 400
COMPOSE_HTTP_TIMEOUT: 400
run: |
export DOCKER_USER_ID=$(id -u)
export DOCKER_GROUP_ID=$(id -u)
# pull the images first to load the docker cache layers
#./acore.sh docker pull
./acore.sh docker build
output=$(./acore.sh version | grep "AzerothCore Rev. ") && version=${output#"AzerothCore Rev. "}
DOCKER_IMAGE_TAG=$version docker compose --profile dev --profile local build
- name: Deploy Dev
#env:
# DOCKER_IMAGE_TAG: ${{ steps.extract_branch.outputs.branch }}
if: github.repository == 'azerothcore/azerothcore-wotlk' && steps.extract_branch.outputs.branch == 'master'
- name: Get version
id: version
run: |
docker compose --profile dev --profile local push
output=$(./acore.sh version | grep "AzerothCore Rev. ") && version=${output#"AzerothCore Rev. "}
DOCKER_IMAGE_TAG=$version docker compose --profile dev --profile local push
output=$(./acore.sh version | grep "AzerothCore Rev. ")
version=${output#"AzerothCore Rev. "}
echo "version=$version" >> $GITHUB_OUTPUT
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

- name: Docker meta
id: meta
uses: docker/metadata-action@v5
with:
images: acore/ac-wotlk-dev-server
tags: |
type=raw,value=${{ steps.version.outputs.version }}
type=ref,event=branch
- name: Build and push
uses: docker/build-push-action@v5
with:
context: ${{ github.workspace }}
file: apps/docker/Dockerfile.dev-server
push: ${{ github.repository == 'azerothcore/azerothcore-wotlk' && github.ref_name == 'master' }}
tags: ${{ steps.meta.outputs.tags }}
build-args: |
USER_ID=1000
GROUP_ID=1000
DOCKER_USER=acore
# TODO: rename this job
docker-build-n-deploy-prod:
strategy:
fail-fast: true
matrix:
os: [ubuntu-20.04]
runs-on: ${{ matrix.os }}
runs-on: "ubuntu-latest"
if: |
github.repository == 'azerothcore/azerothcore-wotlk'
&& !github.event.pull_request.draft
&& (github.ref == 'refs/heads/master' || contains(github.event.pull_request.labels.*.name, 'run-build') || github.event.label.name == 'run-build')
&& (github.ref_name == 'master' || contains(github.event.pull_request.labels.*.name, 'run-build') || github.event.label.name == 'run-build')
env:
COMPOSE_DOCKER_CLI_BUILD: 1
DOCKER_BUILDKIT: 1

steps:
- name: Extract branch name
shell: bash
run: echo "##[set-output name=branch;]$(echo ${GITHUB_REF#refs/heads/})"
id: extract_branch

- name: Configure
- name: Free up disk space
run: |
sudo rm -rf /usr/local/lib/android
sudo rm -rf /usr/share/dotnet
sudo rm -rf /opt/ghc
sudo rm -rf "$AGENT_TOOLSDIRECTORY"
docker --version
docker compose version
- uses: actions/checkout@v4
# we need the entire history for the ac-dev-server
# with:
# fetch-depth: 2

# - name: Set up Docker Buildx
# uses: docker/setup-buildx-action@v1
# The containers created in this workflow are used by
# acore-docker, which has a dependency on mod-eluna.
#
# If you're wanting containers without mod-eluna, the best solution is to
# build them locally (such as with `docker compose build`)
- name: Download Eluna
if: github.repository == 'azerothcore/azerothcore-wotlk' && github.ref_name == 'master'
uses: actions/checkout@v4
with:
repository: azerothcore/mod-eluna
path: modules/mod-eluna

- name: Login to Docker Hub
if: github.repository == 'azerothcore/azerothcore-wotlk' && steps.extract_branch.outputs.branch == 'master'
if: github.repository == 'azerothcore/azerothcore-wotlk' && github.ref_name == 'master'
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}

- name: Cache
uses: actions/cache@v3
with:
path: var/docker/ccache
key: ccache:${{ matrix.os }}:clang:without-modules:${{ github.ref }}:${{ github.sha }}
restore-keys: |
ccache:${{ matrix.os }}:clang:without-modules:${{ github.ref }}
ccache:${{ matrix.os }}:clang:without-modules
- name: Build Production images
if: github.repository == 'azerothcore/azerothcore-wotlk'
env:
#DOCKER_IMAGE_TAG: ${{ steps.extract_branch.outputs.branch }}
DOCKER_CLIENT_TIMEOUT: 220
COMPOSE_HTTP_TIMEOUT: 220
run: |
export DOCKER_USER_ID=$(id -u)
export DOCKER_GROUP_ID=$(id -u)
# pull the images first to load the docker cache layers
#./acore.sh docker prod:pull
./acore.sh docker prod:build
output=$(./acore.sh version | grep "AzerothCore Rev. ") && version=${output#"AzerothCore Rev. "}
DOCKER_IMAGE_TAG=$version ./acore.sh docker prod:build
# create the container to allow the copy right after
docker compose create ac-build-prod
docker compose cp ac-build-prod:/azerothcore/var/ccache var/docker/
echo "ccache exported"
- name: Deploy Production images
#env:
# DOCKER_IMAGE_TAG: ${{ steps.extract_branch.outputs.branch }}
if: github.repository == 'azerothcore/azerothcore-wotlk' && steps.extract_branch.outputs.branch == 'master'
- name: Get version
id: version
run: |
docker compose --profile prod push
output=$(./acore.sh version | grep "AzerothCore Rev. ") && version=${output#"AzerothCore Rev. "}
DOCKER_IMAGE_TAG=$version docker compose --profile prod push
output=$(./acore.sh version | grep "AzerothCore Rev. ")
version=${output#"AzerothCore Rev. "}
echo "version=$version" >> $GITHUB_OUTPUT
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

- name: build worldserver
uses: ./.github/actions/docker-tag-and-build
with:
component-name: worldserver
version: ${{ steps.version.outputs.version }}
push: ${{ github.repository == 'azerothcore/azerothcore-wotlk' && github.ref_name == 'master' }}

- name: build authserver
uses: ./.github/actions/docker-tag-and-build
with:
component-name: authserver
version: ${{ steps.version.outputs.version }}
push: ${{ github.repository == 'azerothcore/azerothcore-wotlk' && github.ref_name == 'master' }}

- name: build db-import
uses: ./.github/actions/docker-tag-and-build
with:
component-name: db-import
version: ${{ steps.version.outputs.version }}
push: ${{ github.repository == 'azerothcore/azerothcore-wotlk' && github.ref_name == 'master' }}

- name: build client-data
uses: ./.github/actions/docker-tag-and-build
with:
component-name: client-data
version: ${{ steps.version.outputs.version }}
push: ${{ github.repository == 'azerothcore/azerothcore-wotlk' && github.ref_name == 'master' }}

- name: build tools
uses: ./.github/actions/docker-tag-and-build
with:
component-name: tools
version: ${{ steps.version.outputs.version }}
push: ${{ github.repository == 'azerothcore/azerothcore-wotlk' && github.ref_name == 'master' }}

dispatch-acore-docker:
needs: [ docker-build-n-deploy-prod , docker-build-n-deploy-dev]
runs-on: ubuntu-latest
steps:
- name: Extract branch name
shell: bash
run: echo "##[set-output name=branch;]$(echo ${GITHUB_REF#refs/heads/})"
id: extract_branch

- name: Repository Dispatch
if: github.repository == 'azerothcore/azerothcore-wotlk' && steps.extract_branch.outputs.branch == 'master'
if: github.repository == 'azerothcore/azerothcore-wotlk' && github.ref_name == 'master'
uses: peter-evans/repository-dispatch@v2
with:
token: ${{ secrets.ACORE_DOCKER_REPO_ACCESS_TOKEN }}
Expand Down
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,8 @@
/src/server/scripts/Custom/*
!/src/server/scripts/Custom/README.md

/docker-compose.override.yml
/*.override.yml
/*.override.yaml

!.gitkeep

Expand Down
Loading

0 comments on commit de00b63

Please sign in to comment.