-
Notifications
You must be signed in to change notification settings - Fork 0
54 lines (53 loc) · 1.6 KB
/
publish.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
name: Build and Push Docker image
on:
push:
branches-ignore:
- master
env:
DOCKERFILE_PATH: build/application
IMAGE_NAME: ${{ github.head_ref || github.ref_name }}
jobs:
build-and-publish-image:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Cache local Maven repository
uses: actions/cache@v3
with:
path: ~/.m2/repository
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
restore-keys: ${{ runner.os }}-maven-
- name: Set up JDK Corretto 21
uses: actions/setup-java@v3
with:
distribution: 'corretto'
java-version: 21
- name: Install NodeJS
uses: actions/setup-node@v3
with:
node-version: 18
- name: Install esbuild
run: npm i -g esbuild
- name: Install TypeScript compiler
run: npm i -g typescript
- name: Give Permissions
run: |
chmod 777 -R .
- name: Maven Build
run: mvn -T 1C clean install -Dmaven.test.skip=true -DskipTests -Dmaven.javadoc.skip=true -Dlicense.skip=true -U
- name: Login to GitHub Container Registry
uses: docker/login-action@v1
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build the Docker image and push it
run: |
cd $DOCKERFILE_PATH
docker build . --tag ghcr.io/${{ github.actor }}/$IMAGE_NAME:latest
docker push ghcr.io/${{ github.actor }}/$IMAGE_NAME:latest