Merge https://github.com/LuckPerms/LuckPerms #5
This file contains 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 Gradle and Publish Docker image | |
on: | |
push: | |
branches: | |
- 'master' | |
tags: | |
- 'v*' | |
pull_request: | |
branches: | |
- 'master' | |
env: | |
REGISTRY: ghcr.io | |
IMAGE_NAME: ${{ github.repository }} | |
jobs: | |
build-gradle: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
- name: validate gradle wrapper | |
uses: gradle/wrapper-validation-action@v1 | |
- uses: actions/setup-java@v3 | |
with: | |
distribution: 'temurin' | |
java-version: '17' | |
- name: Setup Gradle | |
uses: gradle/gradle-build-action@v2 | |
- name: Run build and tests with Gradle wrapper | |
run: ./gradlew test build -PdockerTests | |
- name: Publish test report | |
uses: mikepenz/action-junit-report@v3 | |
if: success() || failure() | |
with: | |
report_paths: '**/build/test-results/test/TEST-*.xml' | |
annotate_notice: true | |
detailed_summary: true | |
- 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 | |
with: | |
fetch-depth: 0 | |
- name: Retrieve saved standalone jar artifact | |
uses: actions/download-artifact@v3 | |
with: | |
name: standalone-binary | |
path: 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: Determine the LuckPerms version | |
run: | | |
echo "luckperms_version=$(git describe --tags | awk -F "-" '{print $1 "." $2}')" >> "$GITHUB_ENV" | |
- 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' }} | |
tags: | | |
type=schedule | |
type=ref,event=branch | |
type=ref,event=tag | |
type=ref,event=pr | |
type=raw,enable=${{ github.ref == 'refs/heads/master' }},value=${{ env.luckperms_version }} | |
- 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 }} |