Skip to content

build for version 1.21.1 #131

build for version 1.21.1

build for version 1.21.1 #131

Workflow file for this run

name: 'build version'
run-name: 'build for version ${{ inputs.download_version }}${{ github.event.client_payload.download_version }}'
on:
workflow_dispatch:
inputs:
download_version:
description: 'papermc server version'
required: true
default: '1.20.6'
# Allows you to trigger this workflow from another workflow
repository_dispatch:
types: [ build_version ]
jobs:
buid_version:
name: build version
runs-on: ubuntu-latest
permissions:
packages: write
contents: read
steps:
- name: checkout the repo
uses: actions/checkout@v4
- name: set version
run: echo "BASE_VERSION=${{ inputs.download_version }}${{ github.event.client_payload.download_version }}" >> $GITHUB_ENV
- name: get build
id: get_build
run: |
BUILDS=$(curl -s -o builds.json https://api.papermc.io/v2/projects/paper/versions/${{ env.BASE_VERSION }}/builds)
BUILD_STABLE=$(jq 'last(.builds[] | select(.channel=="default")).build' builds.json)
BUILD_EXPERIMENTAL=$(jq 'last(.builds[] | select(.channel=="experimental")).build' builds.json)
if [[ "$BUILD_STABLE" =~ ^[0-9]+$ ]]; then
BUILD_NUMBER=$BUILD_STABLE
BUILD_TYPE=stable
else
BUILD_NUMBER=$BUILD_EXPERIMENTAL
BUILD_TYPE=experimental
fi
echo build_number="${BUILD_NUMBER}" >> $GITHUB_OUTPUT
echo build_type="${BUILD_TYPE}" >> $GITHUB_OUTPUT
echo build_url=https://api.papermc.io/v2/projects/paper/versions/${{ env.BASE_VERSION }}/builds/${BUILD_NUMBER} >> $GITHUB_OUTPUT
echo download_url="https://papermc.io/api/v2/projects/paper/versions/${{ env.BASE_VERSION }}/builds/${BUILD_NUMBER}/downloads/paper-${{ env.BASE_VERSION }}-${BUILD_NUMBER}.jar" >> $GITHUB_OUTPUT
- name: show version infos
run: |
echo "version: ${{ env.BASE_VERSION }}"
echo "number: ${{ steps.get_build.outputs.build_number }}"
echo "type: ${{ steps.get_build.outputs.build_type }}"
echo "build: ${{ steps.get_build.outputs.build_url }}"
echo "download: ${{ steps.get_build.outputs.download_url }}"
- name: Log in to docker.io container registry
uses: docker/login-action@v3
env:
PAT: ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }}
if: ${{ env.PAT != '' }}
with:
registry: docker.io
username: ${{ secrets.DOCKER_HUB_USERNAME }}
password: ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }}
- name: Log in to ghcr.io container registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Extract metadata (tags, labels) for container image
id: meta
uses: docker/metadata-action@v5
with:
labels: |
org.opencontainers.image.authors=Marc Tönsing <[email protected]>
org.mojang.minecraft.papermc.version=${{ env.BASE_VERSION }}
org.mojang.minecraft.papermc.build=${{ steps.get_build.outputs.build_number }}
org.mojang.minecraft.papermc.full_version=${{ env.BASE_VERSION }}-${{ steps.get_build.outputs.build_number }}
org.mojang.minecraft.papermc.url=${{ steps.get_build.outputs.build_url }}
org.mojang.minecraft.papermc.type=${{ steps.get_build.outputs.build_type }}
org.mojang.minecraft.papermc.binary=${{ steps.get_build.outputs.download_url }}
tags: |
type=raw,value=${{ env.BASE_VERSION }}
type=raw,value=${{ env.BASE_VERSION }}-${{ steps.get_build.outputs.build_number }}
type=raw,value=latest,enable=${{ github.event.client_payload.is_latest == 'yes' }}
type=raw,value=experimental,enable=${{ github.event.client_payload.is_experimental == 'yes' }}
images: |
name=docker.io/marctv/minecraft-papermc-server,enable=${{ secrets.DOCKER_HUB_ACCESS_TOKEN != '' }}
name=ghcr.io/${{ github.repository }}
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Build and push Docker images
uses: docker/build-push-action@v5
with:
context: .
push: true
platforms: linux/amd64,linux/arm64
provenance: false
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
build-args: |
DOWNLOAD_URL=${{ steps.get_build.outputs.download_url }}