Skip to content

Merge pull request #1106 from lavalink-devs/dev #587

Merge pull request #1106 from lavalink-devs/dev

Merge pull request #1106 from lavalink-devs/dev #587

Workflow file for this run

name: Build
on:
push:
branches: [ '**' ]
paths-ignore:
- '**.md'
- 'docs/**'
- '.github/workflows/docs.yml'
- '.github/workflows/docs-pr.yml'
workflow_call:
secrets:
DOCKER_USERNAME:
required: false
DOCKER_TOKEN:
required: false
DOCKER_REGISTRY:
required: false
DOCKER_IMAGE:
required: false
MAVEN_USERNAME:
required: false
MAVEN_PASSWORD:
required: false
ORG_GRADLE_PROJECT_mavenCentralPassword:
required: false
ORG_GRADLE_PROJECT_mavenCentralUsername:
required: false
ORG_GRADLE_PROJECT_signingInMemoryKey:
required: false
ORG_GRADLE_PROJECT_signingInMemoryKeyPassword:
required: false
jobs:
build:
runs-on: ubuntu-latest
env:
DOCKER_USERNAME: ${{ secrets.DOCKER_USERNAME }}
DOCKER_TOKEN: ${{ secrets.DOCKER_TOKEN }}
DOCKER_REGISTRY: ${{ secrets.DOCKER_REGISTRY }}
DOCKER_IMAGE: ${{ secrets.DOCKER_IMAGE }}
MAVEN_USERNAME: ${{ vars.MAVEN_USERNAME }}
MAVEN_PASSWORD: ${{ secrets.MAVEN_PASSWORD }}
ORG_GRADLE_PROJECT_mavenCentralPassword: ${{ secrets.ORG_GRADLE_PROJECT_MAVENCENTRALPASSWORD }}
ORG_GRADLE_PROJECT_mavenCentralUsername: ${{ secrets.ORG_GRADLE_PROJECT_MAVENCENTRALUSERNAME }}
ORG_GRADLE_PROJECT_signingInMemoryKey: ${{ secrets.ORG_GRADLE_PROJECT_SIGNINGINMEMORYKEY }}
ORG_GRADLE_PROJECT_signingInMemoryKeyPassword: ${{ secrets.ORG_GRADLE_PROJECT_SIGNINGINMEMORYKEYPASSWORD }}
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Java
uses: actions/setup-java@v4
with:
distribution: zulu
java-version: 17
- name: Setup Gradle
uses: gradle/actions/setup-gradle@v3
- name: Execute Gradle build
run: ./gradlew build
- name: Execute Gradle build
run: ./gradlew build -PtargetPlatform=musl
- name: Publish to Maven
run: ./gradlew publish -PMAVEN_USERNAME=$MAVEN_USERNAME -PMAVEN_PASSWORD=$MAVEN_PASSWORD
- name: Upload Artifacts
uses: actions/upload-artifact@v4
with:
name: Lavalink.jar
path: |
LavalinkServer/build/libs/Lavalink.jar
LavalinkServer/build/libs/Lavalink-musl.jar
- name: Docker Meta
id: meta
uses: docker/metadata-action@v5
with:
images: |
ghcr.io/${{ github.repository }}
${{ env.DOCKER_IMAGE }}
tags: |
type=ref,event=branch
type=ref,event=pr
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}
type=semver,pattern={{major}}
type=sha,prefix=
- name: Docker Meta Alpine
id: meta-alpine
uses: docker/metadata-action@v5
with:
images: |
ghcr.io/${{ github.repository }}
${{ env.DOCKER_IMAGE }}
flavor: |
suffix=-alpine,onlatest=true
tags: |
type=ref,event=branch
type=ref,event=pr
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}
type=semver,pattern={{major}}
type=sha,prefix=
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Login to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Log in to docker registry
if: env.DOCKER_USERNAME && env.DOCKER_TOKEN && env.DOCKER_REGISTRY && env.DOCKER_IMAGE
uses: docker/login-action@v3
with:
registry: ${{ env.DOCKER_REGISTRY }}
username: ${{ env.DOCKER_USERNAME }}
password: ${{ env.DOCKER_TOKEN }}
- name: Build Ubuntu and Push
uses: docker/build-push-action@v5
with:
file: LavalinkServer/docker/Dockerfile
context: .
platforms: linux/amd64,linux/arm/v7,linux/arm64/v8
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
- name: Build Alpine and Push
uses: docker/build-push-action@v5
with:
file: LavalinkServer/docker/alpine.Dockerfile
context: .
platforms: linux/amd64,linux/arm64/v8
push: true
tags: ${{ steps.meta-alpine.outputs.tags }}
labels: ${{ steps.meta-alpine.outputs.labels }}