chore(DB): import pending files #241
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: docker-build | |
on: | |
push: | |
branches: | |
- 'master' | |
pull_request: | |
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 }} | |
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') | |
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 | |
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@v3 | |
# 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' | |
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' | |
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 | |
docker-build-n-deploy-prod: | |
strategy: | |
fail-fast: true | |
matrix: | |
os: [ubuntu-20.04] | |
runs-on: ${{ matrix.os }} | |
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') | |
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 | |
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@v3 | |
# 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' | |
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' | |
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 | |
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' | |
uses: peter-evans/repository-dispatch@v2 | |
with: | |
token: ${{ secrets.ACORE_DOCKER_REPO_ACCESS_TOKEN }} | |
repository: azerothcore/acore-docker | |
event-type: azerothcore-new-images | |
client-payload: '{"ref": "${{ github.ref }}", "sha": "${{ github.sha }}"}' |