forked from airsonic-advanced/airsonic-advanced
-
Notifications
You must be signed in to change notification settings - Fork 15
57 lines (55 loc) · 1.83 KB
/
pr_build_docker_from_fork.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
name: 'Build docker image on PR from fork'
on:
pull_request_target:
branches: [main]
types:
- labeled
jobs:
deploy:
runs-on: ubuntu-latest
if: github.repository != github.event.pull_request.head.repo.full_name && contains(github.event.pull_request.labels.*.name, 'safe to test')
steps:
- run: |
echo ${{github.repository}}
echo ${{github.event.pull_request.head.repo.full_name}}}
- uses: actions/checkout@v4
with:
ref: ${{ github.event.pull_request.head.sha }}
- name: Set up JDK
uses: actions/setup-java@v3
with:
java-version: 17
distribution: 'temurin'
- name: Cache Maven packages
uses: actions/cache@v3
with:
path: ~/.m2/repository
key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }}
restore-keys: |
${{ runner.os }}-m2-
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
id: buildx
uses: docker/setup-buildx-action@v3
with:
install: true
- name: Available platforms
run: echo ${{ steps.buildx.outputs.platforms }}
- name: Build with Maven
run: mvn package -DskipTests -B -P integration-test
- name: Login to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build and push images to GHCR
uses: docker/build-push-action@v5
with:
file: install/docker/Dockerfile
context: install/docker
platforms: linux/amd64
push: true
tags: |
ghcr.io/kagemomiji/airsonic-advanced:pr-${{ github.event.pull_request.number }}