chore(deps): update [email protected]:papermc/paper.git digest to 8dc76e7 #2925
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: Build Container Image | |
on: | |
push: | |
paths: | |
- 'utils/build-paper.sh' | |
- 'health.sh' | |
- 'utils/download-mc-monitor.sh' | |
- 'entrypoint.sh' | |
- 'Dockerfile' | |
- '.dockerignore' | |
- '.env' | |
- '.github/workflows/build-image.yml' | |
- 'utils/java.sh' | |
- 'utils/set-tags.sh' | |
- 'test/startup.sh' | |
- 'test/docker-compose.yml' | |
- 'test/server.properties' | |
jobs: | |
build_jar: | |
runs-on: ubuntu-latest | |
outputs: | |
MINECRAFT_VERSION: ${{ steps.paper-commit.outputs.MINECRAFT_VERSION }} | |
PAPER_VERSION: ${{ steps.paper-commit.outputs.PAPER_VERSION }} | |
PAPER_COMMIT: ${{ steps.paper-commit.outputs.PAPER_COMMIT }} | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Get Paper commit | |
id: paper-commit | |
shell: bash | |
run: | | |
source .env | |
{ | |
echo "MINECRAFT_VERSION=${MINECRAFT_VERSION}" | |
echo "PAPER_VERSION=${PAPER_VERSION}" | |
echo "PAPER_COMMIT=${PAPER_COMMIT}" | |
} >> "$GITHUB_OUTPUT" | |
- name: cache paperclip | |
id: cache-paperclip | |
uses: actions/cache@v3 | |
with: | |
path: Paper/paperclip-${{ steps.paper-commit.outputs.PAPER_COMMIT }}.jar | |
key: paperclip-${{ runner.os }}-${{ steps.paper-commit.outputs.PAPER_COMMIT }} | |
- name: clone Paper | |
if: steps.cache-paperclip.outputs.cache-hit != 'true' | |
uses: actions/checkout@v3 | |
with: | |
repository: PaperMC/Paper | |
path: Paper | |
ref: ${{ steps.paper-commit.outputs.PAPER_COMMIT }} | |
- name: setup Java | |
if: steps.cache-paperclip.outputs.cache-hit != 'true' | |
uses: actions/[email protected] | |
with: | |
distribution: 'temurin' | |
java-version: '16.0.2' | |
cache: 'gradle' | |
- name: Build jar | |
if: steps.cache-paperclip.outputs.cache-hit != 'true' | |
run: | | |
ls | |
bash ./utils/build-paper.sh | |
ls -lh Paper/paperclip-${{ steps.paper-commit.outputs.PAPER_COMMIT }}.jar | |
file Paper/paperclip-${{ steps.paper-commit.outputs.PAPER_COMMIT }}.jar | |
- name: Upload paperclip.jar as artifact | |
uses: actions/upload-artifact@v3 | |
with: | |
if-no-files-found: error | |
name: paperclip-${{ steps.paper-commit.outputs.PAPER_COMMIT }} | |
path: Paper/paperclip-${{ steps.paper-commit.outputs.PAPER_COMMIT }}.jar | |
base_img_matrix: | |
name: Generate Base Image matrix | |
runs-on: ubuntu-latest | |
outputs: | |
matrix: ${{ steps.set-matrix.outputs.matrix }} | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Set Base Image matrix | |
id: set-matrix | |
run: | | |
imgs=$(./utils/java.sh base-img | tr '\n' ' ') | |
imgs=$(echo "${imgs}" | sed -e 's/ /, /g') | |
{ | |
echo -n 'matrix=[' | |
echo -n ${imgs} | |
echo ']' | |
} >> "$GITHUB_OUTPUT" | |
build_image: | |
runs-on: ubuntu-latest | |
needs: [build_jar, base_img_matrix] | |
outputs: | |
MINECRAFT_VERSION: ${{ needs.build_jar.outputs.MINECRAFT_VERSION }} | |
PAPER_VERSION: ${{ needs.build_jar.outputs.PAPER_VERSION }} | |
PAPER_COMMIT: ${{ needs.build_jar.outputs.PAPER_COMMIT }} | |
strategy: | |
matrix: | |
base_img: ${{ fromJSON(needs.base_img_matrix.outputs.matrix) }} | |
steps: | |
- uses: actions/checkout@v3 | |
- name: clone Paper | |
uses: actions/checkout@v3 | |
with: | |
repository: PaperMC/Paper | |
path: Paper | |
ref: ${{ needs.build_jar.outputs.PAPER_COMMIT }} | |
- name: download paperclip.jar from artifact | |
uses: actions/download-artifact@v3 | |
with: | |
name: paperclip-${{ needs.build_jar.outputs.PAPER_COMMIT }} | |
path: paperclip-artifact | |
- name: Rename downloaded artifact to Paper/paperclip.jar | |
run: | | |
mv "paperclip-artifact/paperclip-${{ needs.build_jar.outputs.PAPER_COMMIT }}.jar" Paper/paperclip.jar | |
- name: jar exist check | |
run: | | |
ls Paper | |
ls -lh Paper/paperclip.jar | |
file Paper/paperclip.jar | |
if [ -d Paper/paperclip.jar ]; then | |
echo "Oh shit! This paperclip.jar is directory!" | |
exit 1 | |
fi | |
- name: Cache Docker Layers | |
uses: actions/cache@v3 | |
with: | |
path: /tmp/.buildx-cache | |
key: ${{ runner.os }}-buildx-${{ github.sha }} | |
restore-keys: | | |
${{ runner.os }}-buildx- | |
- name: Docker meta | |
id: meta | |
uses: docker/[email protected] | |
with: | |
images: ghcr.io/${{ github.repository }},sksat/${{ github.event.repository.name }} | |
- name: Get base-image info | |
id: img-info | |
shell: bash | |
run: | | |
base=$(cut -d':' -f 1 <<<${{ matrix.base_img }}) | |
tag_digest=$(cut -d':' -f 2 <<<${{ matrix.base_img }}) | |
tag=$(cut -d'@' -f 1 <<<"${tag_digest}") | |
digest=$(cut -d'@' -f 2 <<<"${tag_digest}") | |
echo "base: $base" | |
echo "tag: $tag" | |
echo "digest: $digest" | |
jdk="openjdk" | |
if [[ $base =~ 'eclipse-temurin' ]]; then | |
jdk='temurin' | |
else | |
jdk="$base" | |
fi | |
echo "jdk=${jdk}, base=${tag}" | |
{ | |
echo "jdk=${jdk}" | |
echo "base=${tag}" | |
} >> "$GITHUB_OUTPUT" | |
- name: Set Tags | |
id: tags | |
shell: bash | |
env: | |
JDK: ${{ steps.img-info.outputs.jdk }} | |
BASE_IMG: ${{ steps.img-info.outputs.base }} | |
run: | | |
tags=$(cat << EOS | ./utils/set-tags.sh | |
${{ steps.meta.outputs.tags }} | |
EOS | |
) | |
echo "tags: ${tags}" | |
{ | |
delim="$(openssl rand -hex 8)" | |
echo "tags<<${delim}" | |
echo "${tags}" | |
echo "${delim}" | |
} >> "${GITHUB_OUTPUT}" | |
- name: Login to ghcr.io | |
if: ${{ github.event_name }} != 'pull_request' | |
uses: docker/login-action@v2 | |
with: | |
registry: ghcr.io | |
username: ${{ github.repository_owner }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Login to DockerHub | |
if: ${{ github.event_name }} != 'pull_request' | |
uses: docker/login-action@v2 | |
with: | |
username: sksat | |
password: ${{ secrets.DOCKERHUB_TOKEN }} | |
- name: Set up QEMU | |
id: qemu | |
uses: docker/[email protected] | |
with: | |
platforms: all | |
- name: Set up Buildx | |
id: buildx | |
uses: docker/setup-buildx-action@v2 | |
with: | |
# meantime solution from: https://github.com/docker/buildx/issues/834#issuecomment-965730742 | |
buildkitd-flags: --debug | |
driver-opts: image=moby/buildkit:v0.9.1 | |
- name: Show available platforms | |
run: echo ${{ steps.buildx.outputs.platforms }} | |
- name: Build and Push | |
uses: docker/build-push-action@v4 | |
with: | |
context: . | |
platforms: linux/amd64,linux/arm64 | |
build-args: | | |
"MINECRAFT_VERSION=${{ needs.build_jar.outputs.MINECRAFT_VERSION }}" | |
"PAPER_VERSION=${{ needs.build_jar.outputs.PAPER_VERSION }}" | |
"PAPER_COMMIT=${{ needs.build_jar.outputs.PAPER_COMMIT }}" | |
"BASE_IMG=${{ matrix.base_img }}" | |
push: ${{ github.event_name != 'pull_request' }} | |
tags: ${{ steps.tags.outputs.tags }} | |
labels: ${{ steps.meta.outputs.labels }} | |
cache-from: type=local,src=/tmp/.buildx-cache | |
cache-to: type=local,dest=/tmp/.buildx-cache-new | |
# Temp fix | |
# https://github.com/docker/build-push-action/issues/252 | |
# https://github.com/moby/buildkit/issues/1896 | |
- name: Move cache | |
run: | | |
rm -rf /tmp/.buildx-cache | |
mv /tmp/.buildx-cache-new /tmp/.buildx-cache | |
test: | |
needs: build_image | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
jdk: ["openjdk", "temurin"] | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Install dependencies | |
run: | | |
python --version | |
python3 -m pip install mcstatus | |
- name: startup test | |
run: | | |
./test/startup.sh "${GITHUB_REF#refs/heads/}-${{ needs.build_image.outputs.MINECRAFT_VERSION }}-${{ matrix.jdk }}" |