Skip to content

Commit

Permalink
Update and clean actions
Browse files Browse the repository at this point in the history
  • Loading branch information
meier-rene committed Nov 15, 2024
1 parent 9c595c1 commit b876437
Show file tree
Hide file tree
Showing 4 changed files with 56 additions and 50 deletions.
35 changes: 27 additions & 8 deletions .github/workflows/docker-image-rest.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@

name: Docker Image

on:
Expand All @@ -7,27 +6,47 @@ on:

jobs:
docker:

runs-on: ubuntu-latest

steps:
- name: Checkout
uses: actions/checkout@v4

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

- name: Log in to Docker Hub
uses: docker/login-action@v1
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}

- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@v3
uses: docker/metadata-action@v5
with:
images: ipbhalle/metfragweb

- name: Maven Build Cache for Docker
uses: actions/cache@v4
with:
path: maven-cache
key: ${{ runner.os }}-maven-cache-${{ hashFiles('**/pom.xml') }}

- name: Inject Maven Build Cache into Docker
uses: reproducible-containers/[email protected]
with:
images: ipbhalle/metfragrest
cache-map: |
{
"maven-cache": "/root/.m2"
}
- name: Build and push Docker image
uses: docker/build-push-action@v2
uses: docker/build-push-action@v6
with:
push: true
file: Dockerfile-REST
tags: ipbhalle/metfragrest:latest
cache-from: type=registry,ref=ipbhalle/metfragrest:latest
cache-to: type=inline
labels: ${{ steps.meta.outputs.labels }}
cache-from: type=gha
cache-to: type=gha,mode=max
27 changes: 12 additions & 15 deletions .github/workflows/docker-image.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,20 +13,19 @@ jobs:
runs-on: ubuntu-latest

steps:
-
name: Checkout
- name: Checkout
uses: actions/checkout@v4
-
name: Set up Docker Buildx

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
-
name: Log in to Docker Hub

- name: Log in to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
-
name: Extract metadata (tags, labels) for Docker

- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@v5
with:
Expand All @@ -38,14 +37,14 @@ jobs:
type=raw,value=latest,enable=${{ github.ref == 'refs/heads/master' || startsWith(github.ref, 'refs/tags/') }}
# set dev tag for dev branch
type=raw,value=dev,enable=${{ github.ref == 'refs/heads/dev'}}
-
name: Maven Build Cache for Docker
- name: Maven Build Cache for Docker
uses: actions/cache@v4
with:
path: maven-cache
key: ${{ runner.os }}-maven-cache-${{ hashFiles('**/pom.xml') }}
-
name: Inject Maven Build Cache into Docker

- name: Inject Maven Build Cache into Docker
uses: reproducible-containers/[email protected]
with:
cache-map: |
Expand All @@ -60,6 +59,4 @@ jobs:
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
cache-from: type=gha
cache-to: type=gha,mode=max
# cache-from: type=registry,ref=ipbhalle/metfragweb:buildcache
# cache-to: type=registry,ref=ipbhalle/metfragweb:buildcache,mode=max
cache-to: type=gha,mode=max
19 changes: 7 additions & 12 deletions .github/workflows/maven.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
# This workflow will build a Java project with Maven
# For more information see: https://help.github.com/actions/language-and-framework-guides/building-and-testing-java-with-maven

name: Build with Maven

on:
Expand All @@ -13,15 +10,13 @@ on:

jobs:
build:

runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4
- uses: actions/setup-java@v4
with:
java-version: '17'
distribution: 'temurin'
cache: maven
- run: mvn -Dhttps.protocols=TLSv1.2 -B package --file pom.xml

- uses: actions/checkout@v4
- uses: actions/setup-java@v4
with:
java-version: '17'
distribution: 'temurin'
cache: maven
- run: mvn package
25 changes: 10 additions & 15 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,21 +7,16 @@ on:

jobs:
build:

runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
- uses: actions/setup-java@v2
with:
java-version: '17'
distribution: 'temurin'
cache: maven
- run: mvn -Dhttps.protocols=TLSv1.2 package -pl MetFragCommandLine -am -DskipTests
- name: Add asset to release
uses: softprops/action-gh-release@v1
with:
files: 'MetFragCommandLine/target/MetFragCommandLine-*jar'



- uses: actions/checkout@v4
- uses: actions/setup-java@v4
with:
java-version: '17'
distribution: 'temurin'
- run: mvn package -pl MetFragCommandLine -am -DskipTests
- name: Add asset to release
uses: softprops/action-gh-release@v2
with:
files: 'MetFragCommandLine/target/MetFragCommandLine-*jar'

0 comments on commit b876437

Please sign in to comment.