2022-07-20 23:46:22 +02:00
|
|
|
name: Build Gradle and Publish Docker image
|
|
|
|
|
|
|
|
on:
|
|
|
|
push:
|
|
|
|
branches:
|
|
|
|
- 'master'
|
|
|
|
tags:
|
|
|
|
- 'v*'
|
|
|
|
pull_request:
|
|
|
|
branches:
|
|
|
|
- 'master'
|
|
|
|
|
|
|
|
env:
|
|
|
|
REGISTRY: ghcr.io
|
2022-07-21 00:29:01 +02:00
|
|
|
IMAGE_NAME: ${{ github.repository }}
|
2022-07-20 23:46:22 +02:00
|
|
|
|
|
|
|
jobs:
|
|
|
|
build-gradle:
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
|
|
- name: Checkout repository
|
|
|
|
uses: actions/checkout@v3
|
|
|
|
with:
|
|
|
|
fetch-depth: 0
|
|
|
|
|
|
|
|
- uses: actions/setup-java@v3
|
|
|
|
with:
|
|
|
|
distribution: 'temurin'
|
|
|
|
java-version: '17'
|
|
|
|
|
|
|
|
- name: Setup Gradle
|
|
|
|
uses: gradle/gradle-build-action@v2
|
|
|
|
|
2023-04-01 18:35:50 +02:00
|
|
|
- name: Run build and tests with Gradle wrapper
|
|
|
|
run: ./gradlew test build
|
|
|
|
|
|
|
|
- name: Publish test report
|
|
|
|
uses: mikepenz/action-junit-report@v3
|
|
|
|
if: success() || failure()
|
|
|
|
with:
|
|
|
|
report_paths: '**/build/test-results/test/TEST-*.xml'
|
2022-07-20 23:46:22 +02:00
|
|
|
|
|
|
|
- name: Upload all artifacts
|
|
|
|
uses: actions/upload-artifact@v3
|
|
|
|
with:
|
|
|
|
name: jars
|
|
|
|
path: |
|
|
|
|
bukkit/loader/build/libs/LuckPerms-Bukkit-*.jar
|
|
|
|
bukkit-legacy/loader/build/libs/LuckPerms-Bukkit-Legacy-*.jar
|
|
|
|
bungee/loader/build/libs/LuckPerms-Bungee-*.jar
|
|
|
|
sponge/loader/build/libs/LuckPerms-Sponge-*.jar
|
|
|
|
nukkit/loader/build/libs/LuckPerms-Nukkit-*.jar
|
|
|
|
velocity/build/libs/LuckPerms-Velocity-*.jar
|
|
|
|
fabric/build/libs/LuckPerms-Fabric-*.jar
|
|
|
|
forge/loader/build/libs/LuckPerms-Forge-*.jar
|
|
|
|
standalone/loader/build/libs/LuckPerms-Standalone-*.jar
|
|
|
|
|
|
|
|
- name: Upload standalone artifact
|
|
|
|
uses: actions/upload-artifact@v3
|
|
|
|
with:
|
|
|
|
name: standalone-binary
|
|
|
|
path: standalone/loader/build/libs/LuckPerms-Standalone-*.jar
|
|
|
|
|
|
|
|
|
|
|
|
build-docker:
|
|
|
|
needs: build-gradle
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
permissions:
|
|
|
|
contents: read
|
|
|
|
packages: write
|
|
|
|
|
|
|
|
steps:
|
|
|
|
- name: Checkout repository
|
|
|
|
uses: actions/checkout@v3
|
|
|
|
|
|
|
|
- name: Retrieve saved standalone jar artifact
|
|
|
|
uses: actions/download-artifact@v3
|
|
|
|
with:
|
|
|
|
name: standalone-binary
|
|
|
|
path: standalone/docker/
|
|
|
|
|
|
|
|
- name: Display structure of downloaded files
|
|
|
|
run: ls -R
|
|
|
|
working-directory: standalone/docker/
|
|
|
|
|
|
|
|
- name: Set up QEMU
|
|
|
|
uses: docker/setup-qemu-action@v1
|
|
|
|
|
|
|
|
- name: Set up Docker Buildx
|
|
|
|
uses: docker/setup-buildx-action@v1
|
|
|
|
|
|
|
|
- name: Log in to the Container registry
|
|
|
|
uses: docker/login-action@v1
|
|
|
|
with:
|
|
|
|
registry: ${{ env.REGISTRY }}
|
|
|
|
username: ${{ github.actor }}
|
|
|
|
password: ${{ secrets.GITHUB_TOKEN }}
|
|
|
|
|
|
|
|
- name: Extract metadata for Docker
|
|
|
|
id: meta
|
|
|
|
uses: docker/metadata-action@v3
|
|
|
|
with:
|
|
|
|
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
|
|
|
|
flavor: |
|
|
|
|
latest=${{ github.ref == 'refs/heads/master' }}
|
|
|
|
|
|
|
|
- name: Build and push Docker image
|
|
|
|
uses: docker/build-push-action@v2
|
|
|
|
with:
|
|
|
|
context: standalone/docker/
|
|
|
|
platforms: linux/amd64,linux/arm64
|
|
|
|
push: ${{ github.event_name != 'pull_request' }}
|
|
|
|
tags: ${{ steps.meta.outputs.tags }}
|
|
|
|
labels: ${{ steps.meta.outputs.labels }}
|