2022-01-20 23:09:34 +00:00
|
|
|
name: PullRequest
|
2020-06-28 17:22:00 +00:00
|
|
|
|
|
|
|
on:
|
|
|
|
pull_request:
|
|
|
|
branches: [ master ]
|
2021-12-24 00:38:18 +00:00
|
|
|
types: [assigned, opened, synchronize, labeled]
|
2022-01-02 16:17:32 +00:00
|
|
|
paths-ignore:
|
|
|
|
- "*.md"
|
|
|
|
- "docs/**"
|
|
|
|
- "examples/**"
|
2020-06-28 17:22:00 +00:00
|
|
|
|
2021-12-05 00:42:03 +00:00
|
|
|
env:
|
|
|
|
IMAGE_TO_TEST: itzg/minecraft-server:test-${{ github.repository_owner }}-${{ github.run_id }}
|
|
|
|
|
2020-06-28 17:22:00 +00:00
|
|
|
jobs:
|
2020-07-11 19:09:08 +00:00
|
|
|
test:
|
2021-12-24 00:38:18 +00:00
|
|
|
runs-on: ubuntu-20.04
|
2020-06-28 17:22:00 +00:00
|
|
|
|
|
|
|
steps:
|
2022-03-07 14:17:30 +00:00
|
|
|
- uses: actions/checkout@v3
|
2020-06-28 17:22:00 +00:00
|
|
|
|
2021-12-05 00:42:03 +00:00
|
|
|
- name: Setup Docker Buildx
|
|
|
|
uses: docker/setup-buildx-action@v1
|
|
|
|
|
|
|
|
- name: Build
|
2022-03-23 01:52:32 +00:00
|
|
|
uses: docker/build-push-action@v2.10.0
|
2021-12-05 00:42:03 +00:00
|
|
|
with:
|
|
|
|
context: .
|
|
|
|
platforms: linux/amd64
|
|
|
|
tags: ${{ env.IMAGE_TO_TEST }}
|
|
|
|
load: true
|
|
|
|
cache-from: type=gha
|
|
|
|
|
2020-07-11 19:09:08 +00:00
|
|
|
- name: Run tests
|
2022-02-24 13:25:55 +00:00
|
|
|
env:
|
|
|
|
MODS_FORGEAPI_KEY: ${{ secrets.MODS_FORGEAPI_KEY }}
|
2022-03-06 21:54:25 +00:00
|
|
|
MINECRAFT_VERSION: LATEST
|
2020-07-11 19:09:08 +00:00
|
|
|
run: |
|
|
|
|
tests/test.sh
|
2021-12-24 00:38:18 +00:00
|
|
|
|
|
|
|
- name: Gather Docker metadata
|
|
|
|
if: contains(github.event.pull_request.labels.*.name, 'ci/push-image')
|
|
|
|
id: meta
|
|
|
|
uses: docker/metadata-action@v3
|
|
|
|
with:
|
|
|
|
images: |
|
|
|
|
itzg/minecraft-server
|
|
|
|
|
|
|
|
- name: Login to DockerHub
|
|
|
|
if: contains(github.event.pull_request.labels.*.name, 'ci/push-image')
|
|
|
|
uses: docker/login-action@v1
|
|
|
|
with:
|
|
|
|
username: ${{ secrets.DOCKER_USER }}
|
|
|
|
password: ${{ secrets.DOCKER_PASSWORD }}
|
|
|
|
|
|
|
|
- name: Push
|
|
|
|
if: contains(github.event.pull_request.labels.*.name, 'ci/push-image')
|
2022-03-23 01:52:32 +00:00
|
|
|
uses: docker/build-push-action@v2.10.0
|
2021-12-24 00:38:18 +00:00
|
|
|
with:
|
|
|
|
context: .
|
|
|
|
platforms: linux/amd64,linux/arm/v7,linux/arm64
|
|
|
|
tags: ${{ steps.meta.outputs.tags }}
|
|
|
|
pull: true
|
|
|
|
push: true
|
|
|
|
cache-from: type=gha
|
|
|
|
labels: ${{ steps.meta.outputs.labels }}
|