build for version 26.1.2 #506
This file contains hidden or 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 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://fill.papermc.io/v3/projects/paper/versions/${{ env.BASE_VERSION }}/builds) | |
| # Extract full objects (not just .id) to access download URL | |
| BUILD_STABLE=$(jq 'first(.[] | select(.channel=="STABLE"))' builds.json) | |
| BUILD_BETA=$(jq 'first(.[] | select(.channel=="BETA"))' builds.json) | |
| BUILD_ALPHA=$(jq 'first(.[] | select(.channel=="ALPHA"))' builds.json) | |
| if [[ -n "$BUILD_STABLE" && "$BUILD_STABLE" != "null" ]]; then | |
| BUILD_INFO="$BUILD_STABLE" | |
| BUILD_TYPE=stable | |
| elif [[ -n "$BUILD_BETA" && "$BUILD_BETA" != "null" ]]; then | |
| BUILD_INFO="$BUILD_BETA" | |
| BUILD_TYPE=experimental | |
| else | |
| BUILD_INFO="$BUILD_ALPHA" | |
| BUILD_TYPE=experimental | |
| fi | |
| BUILD_NUMBER=$(echo "$BUILD_INFO" | jq '.id') | |
| echo build_number="${BUILD_NUMBER}" >> $GITHUB_OUTPUT | |
| echo build_type="${BUILD_TYPE}" >> $GITHUB_OUTPUT | |
| echo download_url=$(echo "$BUILD_INFO" | jq -r '.downloads."server:default".url') >> $GITHUB_OUTPUT | |
| echo build_url=https://fill.papermc.io/v3/projects/paper/versions/${{ env.BASE_VERSION }}/builds/${BUILD_NUMBER} >> $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 <marc@marc.tv> | |
| 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 }} |