-
Notifications
You must be signed in to change notification settings - Fork 0
71 lines (66 loc) · 2.03 KB
/
build-pipeline.yaml
File metadata and controls
71 lines (66 loc) · 2.03 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
name: build-pipeline
run-name: ${{ github.repository }} build pipeline
on:
# workflow_dispatch:
# inputs:
# build-push-image:
# type: boolean
# description: Build and Push the Image
push:
branches:
- '**'
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Set up JDK 17
uses: actions/setup-java@v3
with:
java-version: '17'
distribution: 'temurin'
cache: maven
- name: Build with Maven
run: mvn -B clean install --file pom.xml
build-push-image:
needs: build
# if:
# contains(github.ref, 'refs/heads/release/') ||
# contains(github.ref, 'refs/heads/hotfix/') ||
# github.event.inputs.build-push-image == 'true'
runs-on: ubuntu-latest
permissions:
packages: write
contents: read
steps:
- uses: actions/checkout@v4
- name: Log in to the Container registry
uses: docker/login-action@65b78e6e13532edd9afa3aa52ac7964289d1a9c1
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- id: lower-repo
run: |
echo "repo=${GITHUB_REPOSITORY,,}" >> $GITHUB_OUTPUT
- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@9ec57ed1fcdbf14dcef7dfbe97b2010124a938b7
with:
images: |
ghcr.io/${{ steps.lower-repo.outputs.repo }}
tags: |
type=ref,event=branch
type=ref,event=pr
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}
type=sha
- name: Build and push Docker images
uses: docker/build-push-action@3b5e8027fcad23fda98b2e3ac259d8d67585f671
with:
context: .
push: true
tags: |
${{ steps.meta.outputs.tags }}
ghcr.io/${{ steps.lower-repo.outputs.repo }}:latest
labels: ${{ steps.meta.outputs.labels }}