-
Notifications
You must be signed in to change notification settings - Fork 1
64 lines (60 loc) · 1.98 KB
/
minimal-app.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
name: minimal-app-workflow
on:
pull_request:
paths:
- minimal-app/**
- .github/workflows/minimal-app.yml
env:
WORKING_DIR: ./minimal-app
REGISTRY: ghcr.io/octoconsulting
IMAGE_NAME: keip/minimal-app
JAVA_VERSION: 17
jobs:
build:
name: build image
if: github.ref != 'refs/heads/main'
runs-on: ubuntu-latest
defaults:
run:
shell: bash
working-directory: ${{ env.WORKING_DIR }}
steps:
- uses: actions/checkout@v4
- uses: actions/setup-java@v3
with:
java-version: "${{ env.JAVA_VERSION }}"
distribution: "temurin"
- run: mvn --batch-mode --update-snapshots verify
name: build image
release:
name: push image
if: github.ref == 'refs/heads/main'
runs-on: ubuntu-latest
defaults:
run:
shell: bash
working-directory: ${{ env.WORKING_DIR }}
# Sets the permissions granted to the `GITHUB_TOKEN` for the actions in this job.
permissions:
contents: read
packages: write
steps:
- uses: actions/checkout@v4
- uses: actions/setup-java@v3
with:
java-version: "${{ env.JAVA_VERSION }}"
distribution: "temurin"
- run: echo "IMAGE_TAG=${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:$(mvn help:evaluate -Dexpression=project.version -q -DforceStdout)" >> "$GITHUB_OUTPUT"
id: image-name-selector
name: generate image name
- run: "! docker manifest inspect ${{ steps.image-name-selector.outputs.IMAGE_TAG }}"
name: confirm image is not already pushed
- run: mvn --batch-mode --update-snapshots verify
name: build image
- uses: docker/login-action@65b78e6e13532edd9afa3aa52ac7964289d1a9c1
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- run: docker push ${{ steps.image-name-selector.outputs.IMAGE_TAG }}
# TODO git tag after push with "keip-default-image:version"