-
-
Notifications
You must be signed in to change notification settings - Fork 672
150 lines (134 loc) · 4.63 KB
/
build.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
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@v3
- name: Setup Java
uses: actions/setup-java@v3
with:
distribution: zulu
java-version: 17
cache: gradle
- name: Setup Gradle
uses: gradle/gradle-build-action@v2
- name: Execute Gradle build
run: ./gradlew clean build
- name: Execute Gradle build (musl)
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@v3
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@v4
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@v4
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@v2
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Login to GitHub Container Registry
uses: docker/login-action@v2
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@v2
with:
registry: ${{ env.DOCKER_REGISTRY }}
username: ${{ env.DOCKER_USERNAME }}
password: ${{ env.DOCKER_TOKEN }}
- name: Build Ubuntu and Push
uses: docker/build-push-action@v3
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@v3
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 }}