-
Notifications
You must be signed in to change notification settings - Fork 0
43 lines (43 loc) · 1.36 KB
/
publish.yaml
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
# Publish JAR and docker image to Github packages
name: publish-artifacts
run-name: Publish artifacts to Github packages
on:
push:
tags:
- '*'
env:
REGISTRY: ghcr.io
# Image name must be lower case
IMAGE_NAME: informatievlaanderen/magda-mock
jobs:
publish:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/cache@v3
with:
path: ~/.m2/repository
key: mvn-cache
- uses: actions/setup-java@v3
with:
java-version: '21'
distribution: 'temurin'
- name: Publish
# Disable tester module because it depends on an internal library.
# Disable artifactory profile and enable github for deployment.
run: mvn --batch-mode deploy -pl "!tester" -P "!artifactory,github"
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Login to docker registry
uses: docker/login-action@v2
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build and push docker image
uses: docker/build-push-action@v4
with:
context: magdaservice
file: magdaservice/src/main/docker/Dockerfile-github
push: true
tags: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ github.ref_name }}