forked from Lonsofore/cod2docker
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
be2854e
commit 12808e2
Showing
5 changed files
with
104 additions
and
157 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,85 @@ | ||
name: Reusable Docker Build and Push | ||
|
||
on: | ||
workflow_call: | ||
inputs: | ||
cod2_patch: | ||
type: string | ||
description: 'CoD2 patch to use (0=1.0, 3=1.3)' | ||
mysql_variant: | ||
type: string | ||
description: 'MySQL variant to use (0=disabled, 1=normal, 2=voron)' | ||
enable_speex: | ||
type: boolean | ||
default: false | ||
enable_unsafe: | ||
type: boolean | ||
default: false | ||
enable_push: | ||
type: boolean | ||
default: false | ||
libcod_commit: | ||
type: string | ||
description: 'Commit hash of libcod to use' | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v2 | ||
|
||
- name: Login to DockerHub | ||
uses: docker/login-action@v1 | ||
with: | ||
username: ${{ secrets.DOCKERHUB_USERNAME }} | ||
password: ${{ secrets.DOCKERHUB_TOKEN }} | ||
|
||
- name: Set up Docker Buildx | ||
uses: docker/setup-buildx-action@v3 | ||
|
||
- name: Construct Tag | ||
run: | | ||
tag="rutkowski/cod2:$(cat __version__)-server1.${{ inputs.cod2_patch }}" | ||
if [[ "${{ inputs.mysql_variant }}" == "1" ]]; then | ||
tag="${tag}-mysql" | ||
elif [[ "${{ inputs.mysql_variant }}" == "2" ]]; then | ||
tag="${tag}-mysqlvoron" | ||
fi | ||
if [[ "${{ inputs.enable_speex }}" == "1" ]]; then | ||
tag="${tag}-speex" | ||
fi | ||
if [[ "${{ inputs.enable_unsafe }}" == "1" ]]; then | ||
tag="${tag}-unsafe" | ||
fi | ||
echo $tag | ||
echo "DOCKER_TAG=${tag}" >> $GITHUB_ENV | ||
- name: Cache Docker layers | ||
uses: actions/cache@v4 | ||
with: | ||
path: /tmp/.buildx-cache | ||
key: ${{ runner.os }}-buildx-${{ github.sha }} | ||
restore-keys: | | ||
${{ runner.os }}-buildx- | ||
- name: Build and push | ||
uses: docker/build-push-action@v2 | ||
with: | ||
context: . | ||
file: ./Dockerfile | ||
push: ${{ inputs.enable_push }} | ||
tags: ${{ env.DOCKER_TAG }} | ||
build-args: | | ||
cod2_patch=${{ inputs.cod2_patch }} | ||
mysql_variant=${{ inputs.mysql_variant }} | ||
speex=${{ inputs.enable_speex }} | ||
enable_unsafe=${{ inputs.enable_unsafe }} | ||
libcod_commit=${{ inputs.libcod_commit }} | ||
cache-from: type=local,src=/tmp/.buildx-cache | ||
cache-to: type=local,dest=/tmp/.buildx-cache-new | ||
|
||
- name: Move Docker cache | ||
run: | | ||
rm -rf /tmp/.buildx-cache | ||
mv /tmp/.buildx-cache-new /tmp/.buildx-cache |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,37 +1,14 @@ | ||
name: Build and push docker image | ||
name: Build docker image | ||
|
||
on: push | ||
|
||
jobs: | ||
build: | ||
strategy: | ||
matrix: | ||
cod2_patch: [3] | ||
mysql_variant: [2] | ||
speex: [1] | ||
enable_unsafe: [1] | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v2 | ||
|
||
- name: Login to DockerHub | ||
uses: docker/login-action@v1 | ||
with: | ||
username: ${{ secrets.DOCKERHUB_USERNAME }} | ||
password: ${{ secrets.DOCKERHUB_TOKEN }} | ||
|
||
- name: Build all images and push | ||
run: | | ||
PUSH_VALUE=0 | ||
if [[ "${{ github.ref }}" == "refs/heads/master" ]]; then | ||
PUSH_VALUE=1 | ||
fi | ||
./scripts/build.sh \ | ||
--image_name=rutkowski/cod2 \ | ||
--cod2_patch=${{ matrix.cod2_patch }} \ | ||
--mysql_variant=${{ matrix.mysql_variant }} \ | ||
--speex=${{ matrix.speex }} \ | ||
--enable_unsafe=${{ matrix.enable_unsafe }} \ | ||
--push=$PUSH_VALUE | ||
call-reusable-workflow: | ||
uses: ./.github/workflows/build-push.yml | ||
with: | ||
cod2_patch: 3 | ||
mysql_variant: 2 | ||
enable_speex: true | ||
enable_unsafe: true | ||
push: false | ||
libcod_commit: "5f04a7f4e60d910945f13a786d15081843b72baf" |
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
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.