mirror of
https://github.com/itzg/docker-minecraft-server.git
synced 2024-06-07 19:40:43 +00:00
74 lines
1.7 KiB
YAML
74 lines
1.7 KiB
YAML
name: PullRequest
|
|
|
|
on:
|
|
pull_request:
|
|
branches: [ master ]
|
|
types: [assigned, opened, synchronize, labeled]
|
|
paths-ignore:
|
|
- "*.md"
|
|
- "docs/**"
|
|
- "examples/**"
|
|
|
|
env:
|
|
IMAGE_TO_TEST: itzg/minecraft-server:test-${{ github.repository_owner }}-${{ github.run_id }}
|
|
|
|
jobs:
|
|
test:
|
|
runs-on: ubuntu-20.04
|
|
|
|
steps:
|
|
- uses: actions/checkout@v3
|
|
|
|
- name: Setup Docker Buildx
|
|
uses: docker/setup-buildx-action@v2
|
|
|
|
- name: Build
|
|
uses: docker/build-push-action@v3.0.0
|
|
with:
|
|
context: .
|
|
platforms: linux/amd64
|
|
tags: ${{ env.IMAGE_TO_TEST }}
|
|
load: true
|
|
cache-from: type=gha
|
|
|
|
- name: Run tests
|
|
env:
|
|
MODS_FORGEAPI_KEY: ${{ secrets.MODS_FORGEAPI_KEY }}
|
|
MINECRAFT_VERSION: 1.18.2
|
|
run: |
|
|
tests/test.sh
|
|
push:
|
|
runs-on: ubuntu-20.04
|
|
needs:
|
|
- test
|
|
if: contains(github.event.pull_request.labels.*.name, 'ci/push-image')
|
|
steps:
|
|
- uses: actions/checkout@v3
|
|
|
|
- name: Setup Docker Buildx
|
|
uses: docker/setup-buildx-action@v2
|
|
|
|
- name: Gather Docker metadata
|
|
id: meta
|
|
uses: docker/metadata-action@v4
|
|
with:
|
|
images: |
|
|
itzg/minecraft-server
|
|
|
|
- name: Login to DockerHub
|
|
uses: docker/login-action@v2
|
|
with:
|
|
username: ${{ secrets.DOCKER_USER }}
|
|
password: ${{ secrets.DOCKER_PASSWORD }}
|
|
|
|
- name: Push
|
|
uses: docker/build-push-action@v3.0.0
|
|
with:
|
|
context: .
|
|
platforms: linux/amd64
|
|
tags: ${{ steps.meta.outputs.tags }}
|
|
pull: true
|
|
push: true
|
|
cache-from: type=gha
|
|
labels: ${{ steps.meta.outputs.labels }}
|