mirror of
https://github.com/mod-playerbots/azerothcore-wotlk.git
synced 2026-01-13 01:08:35 +00:00
refactor(CI): Squash docker ci into one workflow (#17880)
* refactor(CI): Squash docker ci into one workflow * fiddle with variable * use proper dockerfile target
This commit is contained in:
@@ -13,6 +13,10 @@ inputs:
|
|||||||
description: version tag to use for docker image
|
description: version tag to use for docker image
|
||||||
required: true
|
required: true
|
||||||
type: string
|
type: string
|
||||||
|
dockerfile:
|
||||||
|
description: dockerfile to use
|
||||||
|
required: false
|
||||||
|
default: apps/docker/Dockerfile
|
||||||
runs:
|
runs:
|
||||||
using: composite
|
using: composite
|
||||||
steps:
|
steps:
|
||||||
@@ -29,7 +33,7 @@ runs:
|
|||||||
uses: docker/build-push-action@v5
|
uses: docker/build-push-action@v5
|
||||||
with:
|
with:
|
||||||
context: ${{ github.workspace }}
|
context: ${{ github.workspace }}
|
||||||
file: apps/docker/Dockerfile
|
file: ${{ inputs.dockerfile }}
|
||||||
push: ${{ inputs.push }}
|
push: ${{ inputs.push }}
|
||||||
tags: ${{ steps.meta.outputs.tags }}
|
tags: ${{ steps.meta.outputs.tags }}
|
||||||
target: ${{ inputs.component-name }}
|
target: ${{ inputs.component-name }}
|
||||||
|
|||||||
110
.github/workflows/docker_build.yml
vendored
110
.github/workflows/docker_build.yml
vendored
@@ -14,76 +14,19 @@ concurrency:
|
|||||||
group: ${{ github.head_ref }} || concat(${{ github.ref }}, ${{ github.workflow }})
|
group: ${{ github.head_ref }} || concat(${{ github.ref }}, ${{ github.workflow }})
|
||||||
cancel-in-progress: true
|
cancel-in-progress: true
|
||||||
|
|
||||||
|
env:
|
||||||
|
COMPOSE_DOCKER_CLI_BUILD: 1
|
||||||
|
DOCKER_BUILDKIT: 1
|
||||||
|
RUNNING_ON_PRIMARY_BRANCH: |
|
||||||
|
${{ (github.repository == 'azerothcore/azerothcore-wotlk' && github.ref_name == 'master') && 'true' || 'false' }}
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
docker-build-n-deploy-dev:
|
build-containers:
|
||||||
runs-on: "ubuntu-latest"
|
runs-on: "ubuntu-latest"
|
||||||
if: |
|
if: |
|
||||||
github.repository == 'azerothcore/azerothcore-wotlk'
|
github.repository == 'azerothcore/azerothcore-wotlk'
|
||||||
&& !github.event.pull_request.draft
|
&& !github.event.pull_request.draft
|
||||||
&& (github.ref_name == '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: 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"
|
|
||||||
|
|
||||||
- uses: actions/checkout@v4
|
|
||||||
|
|
||||||
- name: Login to Docker Hub
|
|
||||||
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: Get version
|
|
||||||
id: version
|
|
||||||
run: |
|
|
||||||
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:
|
|
||||||
runs-on: "ubuntu-latest"
|
|
||||||
if: |
|
|
||||||
github.repository == 'azerothcore/azerothcore-wotlk'
|
|
||||||
&& !github.event.pull_request.draft
|
|
||||||
&& (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:
|
steps:
|
||||||
- name: Free up disk space
|
- name: Free up disk space
|
||||||
run: |
|
run: |
|
||||||
@@ -100,14 +43,14 @@ jobs:
|
|||||||
# If you're wanting containers without mod-eluna, the best solution is to
|
# If you're wanting containers without mod-eluna, the best solution is to
|
||||||
# build them locally (such as with `docker compose build`)
|
# build them locally (such as with `docker compose build`)
|
||||||
- name: Download Eluna
|
- name: Download Eluna
|
||||||
if: github.repository == 'azerothcore/azerothcore-wotlk' && github.ref_name == 'master'
|
if: env.RUNNING_ON_PRIMARY_BRANCH == 'true'
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v4
|
||||||
with:
|
with:
|
||||||
repository: azerothcore/mod-eluna
|
repository: azerothcore/mod-eluna
|
||||||
path: modules/mod-eluna
|
path: modules/mod-eluna
|
||||||
|
|
||||||
- name: Login to Docker Hub
|
- name: Login to Docker Hub
|
||||||
if: github.repository == 'azerothcore/azerothcore-wotlk' && github.ref_name == 'master'
|
if: env.RUNNING_ON_PRIMARY_BRANCH == 'true'
|
||||||
uses: docker/login-action@v1
|
uses: docker/login-action@v1
|
||||||
with:
|
with:
|
||||||
username: ${{ secrets.DOCKERHUB_USERNAME }}
|
username: ${{ secrets.DOCKERHUB_USERNAME }}
|
||||||
@@ -116,8 +59,7 @@ jobs:
|
|||||||
- name: Get version
|
- name: Get version
|
||||||
id: version
|
id: version
|
||||||
run: |
|
run: |
|
||||||
output=$(./acore.sh version | grep "AzerothCore Rev. ")
|
version="$(jq -r '.version' acore.json)"
|
||||||
version=${output#"AzerothCore Rev. "}
|
|
||||||
echo "version=$version" >> $GITHUB_OUTPUT
|
echo "version=$version" >> $GITHUB_OUTPUT
|
||||||
|
|
||||||
- name: Set up Docker Buildx
|
- name: Set up Docker Buildx
|
||||||
@@ -128,45 +70,53 @@ jobs:
|
|||||||
with:
|
with:
|
||||||
component-name: worldserver
|
component-name: worldserver
|
||||||
version: ${{ steps.version.outputs.version }}
|
version: ${{ steps.version.outputs.version }}
|
||||||
push: ${{ github.repository == 'azerothcore/azerothcore-wotlk' && github.ref_name == 'master' }}
|
push: ${{ env.RUNNING_ON_PRIMARY_BRANCH }}
|
||||||
|
|
||||||
- name: build authserver
|
- name: build authserver
|
||||||
uses: ./.github/actions/docker-tag-and-build
|
uses: ./.github/actions/docker-tag-and-build
|
||||||
with:
|
with:
|
||||||
component-name: authserver
|
component-name: authserver
|
||||||
version: ${{ steps.version.outputs.version }}
|
version: ${{ steps.version.outputs.version }}
|
||||||
push: ${{ github.repository == 'azerothcore/azerothcore-wotlk' && github.ref_name == 'master' }}
|
push: ${{ env.RUNNING_ON_PRIMARY_BRANCH }}
|
||||||
|
|
||||||
- name: build db-import
|
- name: build db-import
|
||||||
uses: ./.github/actions/docker-tag-and-build
|
uses: ./.github/actions/docker-tag-and-build
|
||||||
with:
|
with:
|
||||||
component-name: db-import
|
component-name: db-import
|
||||||
version: ${{ steps.version.outputs.version }}
|
version: ${{ steps.version.outputs.version }}
|
||||||
push: ${{ github.repository == 'azerothcore/azerothcore-wotlk' && github.ref_name == 'master' }}
|
push: ${{ env.RUNNING_ON_PRIMARY_BRANCH }}
|
||||||
|
|
||||||
- name: build client-data
|
- name: build client-data
|
||||||
uses: ./.github/actions/docker-tag-and-build
|
uses: ./.github/actions/docker-tag-and-build
|
||||||
with:
|
with:
|
||||||
component-name: client-data
|
component-name: client-data
|
||||||
version: ${{ steps.version.outputs.version }}
|
version: ${{ steps.version.outputs.version }}
|
||||||
push: ${{ github.repository == 'azerothcore/azerothcore-wotlk' && github.ref_name == 'master' }}
|
push: ${{ env.RUNNING_ON_PRIMARY_BRANCH }}
|
||||||
|
|
||||||
- name: build tools
|
- name: build tools
|
||||||
uses: ./.github/actions/docker-tag-and-build
|
uses: ./.github/actions/docker-tag-and-build
|
||||||
with:
|
with:
|
||||||
component-name: tools
|
component-name: tools
|
||||||
version: ${{ steps.version.outputs.version }}
|
version: ${{ steps.version.outputs.version }}
|
||||||
push: ${{ github.repository == 'azerothcore/azerothcore-wotlk' && github.ref_name == 'master' }}
|
push: ${{ env.RUNNING_ON_PRIMARY_BRANCH }}
|
||||||
|
|
||||||
dispatch-acore-docker:
|
- name: build dev-server
|
||||||
needs: [ docker-build-n-deploy-prod , docker-build-n-deploy-dev]
|
uses: ./.github/actions/docker-tag-and-build
|
||||||
runs-on: ubuntu-latest
|
with:
|
||||||
steps:
|
component-name: dev
|
||||||
- name: Repository Dispatch
|
version: ${{ steps.version.outputs.version }}
|
||||||
if: github.repository == 'azerothcore/azerothcore-wotlk' && github.ref_name == 'master'
|
push: ${{ env.RUNNING_ON_PRIMARY_BRANCH }}
|
||||||
|
dockerfile: apps/docker/Dockerfile.dev-server
|
||||||
|
|
||||||
|
- name: Trigger acore-docker CI
|
||||||
|
if: env.RUNNING_ON_PRIMARY_BRANCH == 'true'
|
||||||
uses: peter-evans/repository-dispatch@v2
|
uses: peter-evans/repository-dispatch@v2
|
||||||
with:
|
with:
|
||||||
token: ${{ secrets.ACORE_DOCKER_REPO_ACCESS_TOKEN }}
|
token: ${{ secrets.ACORE_DOCKER_REPO_ACCESS_TOKEN }}
|
||||||
repository: azerothcore/acore-docker
|
repository: azerothcore/acore-docker
|
||||||
event-type: azerothcore-new-images
|
event-type: azerothcore-new-images
|
||||||
client-payload: '{"ref": "${{ github.ref }}", "sha": "${{ github.sha }}"}'
|
client-payload: >
|
||||||
|
{
|
||||||
|
"ref": "${{ github.ref }}",
|
||||||
|
"sha": "${{ github.sha }}"
|
||||||
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user