Testing an alternative approach to the CI
This commit is contained in:
parent
5be6e30444
commit
0dd98315e5
@ -3,3 +3,4 @@
|
|||||||
.gitignore
|
.gitignore
|
||||||
.gitlab-ci.yml
|
.gitlab-ci.yml
|
||||||
README.md
|
README.md
|
||||||
|
build.sh
|
||||||
|
@ -10,14 +10,13 @@ variables:
|
|||||||
CI_PROJECT_NAME: minecraft-forge
|
CI_PROJECT_NAME: minecraft-forge
|
||||||
stages:
|
stages:
|
||||||
- build
|
- build
|
||||||
# - test
|
|
||||||
- push
|
|
||||||
services:
|
services:
|
||||||
- docker:dind
|
- docker:dind
|
||||||
before_script:
|
before_script:
|
||||||
- echo -n "$CI_LOGIN_PASSWORD" | docker login -u "$CI_LOGIN_USERNAME" --password-stdin
|
- echo -n "$CI_LOGIN_PASSWORD" | docker login -u "$CI_LOGIN_USERNAME" --password-stdin
|
||||||
- docker version
|
- docker version
|
||||||
- docker info
|
- docker info
|
||||||
|
- apk add bash
|
||||||
after_script:
|
after_script:
|
||||||
- docker logout hub.docker.com
|
- docker logout hub.docker.com
|
||||||
|
|
||||||
@ -25,43 +24,4 @@ after_script:
|
|||||||
Build:
|
Build:
|
||||||
stage: build
|
stage: build
|
||||||
script:
|
script:
|
||||||
- docker pull $CI_HUB_USERNAME/$CI_PROJECT_NAME:latest || true
|
- bash build.sh
|
||||||
- docker buildx create --use
|
|
||||||
- >
|
|
||||||
docker buildx build
|
|
||||||
--pull
|
|
||||||
--platform linux/amd64
|
|
||||||
--cache-from $CI_HUB_USERNAME/$CI_PROJECT_NAME:latest
|
|
||||||
--tag $CI_HUB_USERNAME/$CI_PROJECT_NAME:$CI_COMMIT_SHORT_SHA
|
|
||||||
--push
|
|
||||||
.
|
|
||||||
- docker images
|
|
||||||
|
|
||||||
# PUSH
|
|
||||||
Push_When_Tag:
|
|
||||||
stage: push
|
|
||||||
only:
|
|
||||||
- tags
|
|
||||||
script:
|
|
||||||
- docker pull $CI_HUB_USERNAME/$CI_PROJECT_NAME:$CI_COMMIT_SHORT_SHA
|
|
||||||
- >
|
|
||||||
docker tag
|
|
||||||
$CI_HUB_USERNAME/$CI_PROJECT_NAME:$CI_COMMIT_SHORT_SHA
|
|
||||||
$CI_HUB_USERNAME/$CI_PROJECT_NAME:$CI_COMMIT_REF_NAME
|
|
||||||
- >
|
|
||||||
docker tag
|
|
||||||
$CI_HUB_USERNAME/$CI_PROJECT_NAME:$CI_COMMIT_SHORT_SHA
|
|
||||||
$CI_HUB_USERNAME/$CI_PROJECT_NAME:latest
|
|
||||||
- docker images
|
|
||||||
- docker push $CI_HUB_USERNAME/$CI_PROJECT_NAME:$CI_COMMIT_REF_NAME
|
|
||||||
- docker push $CI_HUB_USERNAME/$CI_PROJECT_NAME:latest
|
|
||||||
Push_Bleeding:
|
|
||||||
stage: push
|
|
||||||
script:
|
|
||||||
- docker pull $CI_HUB_USERNAME/$CI_PROJECT_NAME:$CI_COMMIT_SHORT_SHA
|
|
||||||
- >
|
|
||||||
docker tag
|
|
||||||
$CI_HUB_USERNAME/$CI_PROJECT_NAME:$CI_COMMIT_SHORT_SHA
|
|
||||||
$CI_HUB_USERNAME/$CI_PROJECT_NAME:bleeding
|
|
||||||
- docker images
|
|
||||||
- docker push $CI_HUB_USERNAME/$CI_PROJECT_NAME:bleeding
|
|
||||||
|
29
build.sh
Executable file
29
build.sh
Executable file
@ -0,0 +1,29 @@
|
|||||||
|
#! /bin/bash
|
||||||
|
#
|
||||||
|
# Build the Docker image for a series of different Forge versions
|
||||||
|
#
|
||||||
|
|
||||||
|
# MC version list
|
||||||
|
declare -a mcversions=(
|
||||||
|
"1.12.2"
|
||||||
|
"1.16.5"
|
||||||
|
)
|
||||||
|
|
||||||
|
# Forge version dictionary (we only support one version per)
|
||||||
|
declare -A forgeversions=(
|
||||||
|
["1.12.2"]="14.23.5.2855"
|
||||||
|
["1.16.5"]="36.1.23"
|
||||||
|
)
|
||||||
|
|
||||||
|
# Build images
|
||||||
|
docker buildx create --use
|
||||||
|
for mc in ${mcversions[@]}; do
|
||||||
|
forge="${forgeversions[$mc]}"
|
||||||
|
echo "Building image for Minecraft $mc, Forge $forge, CI_COMMIT_REF_NAME of $CI_COMMIT_REF_NAME"
|
||||||
|
docker buildx build \
|
||||||
|
--platform linux/amd64 \
|
||||||
|
--tag "$CI_HUB_USERNAME/$CI_PROJECT_NAME:$mc-$forge-${CI_COMMIT_REF_NAME:=bleeding}" \
|
||||||
|
--push \
|
||||||
|
.
|
||||||
|
done
|
||||||
|
docker images
|
Loading…
Reference in New Issue
Block a user