Skip to content

fix prject

fix prject #853

name: Maven GitHub Actions Sample
on: [push]
jobs:
compile:
runs-on: ubuntu-latest
strategy:
matrix:
java: [ 21 ]
name: Java ${{ matrix.java }} compile
steps:
- name: Checkout Source Code
uses: actions/checkout@v3
- name: Setup Java
uses: actions/setup-java@v3
with:
distribution: 'adopt'
java-package: jdk
java-version: ${{ matrix.java }}
- name: Compile the Project
run: ./mvnw -f github-actions-java-maven/pom.xml -B compile
build:
runs-on: ubuntu-latest
needs: compile
name: Build the Maven Project
steps:
- uses: actions/checkout@v3
- name: Set up JDK 21
uses: actions/setup-java@v3
with:
distribution: 'adopt'
java-version: '21'
java-package: jdk
cache: 'maven'
- name: Build and test project
run: ./mvnw -f github-actions-java-maven/pom.xml -B verify
- name: Upload Maven build artifact
uses: actions/upload-artifact@v2
with:
name: artifact.jar
path: github-actions-java-maven/target/github-actions-java-maven.jar
deploy:
runs-on: ubuntu-latest
needs: build
name: Build Docker Container and Deploy to Kubernetes
steps:
- uses: actions/checkout@v3
- name: Download Maven build artifact
uses: actions/download-artifact@v2
with:
name: artifact.jar
path: github-actions-java-maven/target
- name: Build Docker container
working-directory: github-actions-java-maven
run: |
docker build -t de.rieckpil.blog/github-actions-sample .
- name: Access secrets
env:
SUPER_SECRET: ${{ secrets.SUPER_SECRET }}
run: echo "Content of secret - $SUPER_SECRET"
- name: Push Docker images
run: echo "Pushing Docker image to Container Registry (e.g. ECR)"
- name: Deploy application
run: echo "Deploying application (e.g. Kubernetes)"