forked from sismics/docs
-
Notifications
You must be signed in to change notification settings - Fork 0
107 lines (86 loc) · 2.68 KB
/
build-deploy.yml
File metadata and controls
107 lines (86 loc) · 2.68 KB
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
name: Build and Publish
on:
push:
branches: [main, "release/**", "fix/**"]
tags: [v*]
workflow_dispatch:
env:
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}
jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v5
- name: Set up JDK 21
uses: actions/setup-java@v5
with:
java-version: "21"
distribution: "temurin"
cache: maven
- name: Install test dependencies
run: sudo apt-get update && sudo apt-get -y -q --no-install-recommends install ffmpeg mediainfo tesseract-ocr tesseract-ocr-deu
- name: Run tests
run: ./mvnw --batch-mode test
build:
runs-on: ubuntu-latest
needs: [test]
steps:
- uses: actions/checkout@v5
- name: Set up JDK 21
uses: actions/setup-java@v5
with:
java-version: "21"
distribution: "temurin"
cache: maven
- name: Install frontend dependencies
run: cd docs-web/src/main/webapp && npm install
- name: Build with Maven
run: ./mvnw --batch-mode -Pprod clean install -DskipTests
- name: Upload war artifact
uses: actions/upload-artifact@v6
with:
name: docs-web.war
path: docs-web/target/docs*.war
docker:
runs-on: ubuntu-latest
needs: [build]
permissions:
contents: read
packages: write
steps:
- uses: actions/checkout@v5
- name: Download war artifact
uses: actions/download-artifact@v7
with:
name: docs-web.war
path: docs-web/target
- name: Set up QEMU
uses: docker/setup-qemu-action@v4
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v4
- name: Log in to GHCR
uses: docker/login-action@v4
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Docker metadata
id: metadata
uses: docker/metadata-action@v6
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
flavor: |
latest=false
tags: |
type=ref,event=tag
type=raw,value=latest,enable=${{ github.ref == 'refs/heads/main' }}
type=raw,value={{branch}}-rc-{{sha}},enable=${{ startsWith(github.ref, 'refs/heads/release/') }}
- name: Build and push
uses: docker/build-push-action@v7
with:
context: .
platforms: linux/amd64,linux/arm64
push: ${{ github.event_name != 'pull_request' }}
tags: ${{ steps.metadata.outputs.tags }}
labels: ${{ steps.metadata.outputs.labels }}