Skip to content
Permalink
Branch: master
Find file Copy path
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
64 lines (62 sloc) 1.99 KB
name: Build sample Java Maven project
on: [push, pull_request]
jobs:
compile:
runs-on: ubuntu-latest
strategy:
matrix:
java: [ 11, 12, 13 ]
name: Java ${{ matrix.java }} compile
steps:
- uses: actions/checkout@master
- name: Setup java
uses: actions/setup-java@v1
with:
java-version: ${{ matrix.java }}
- run: mvn -f github-actions-java-maven/pom.xml clean compile
build:
runs-on: ubuntu-latest
needs: compile
name: Build Maven project
steps:
- uses: actions/checkout@v1
- uses: actions/cache@v1
with:
path: ~/.m2/repository
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
restore-keys: |
${{ runner.os }}-maven-
- name: Set up JDK 11
uses: actions/setup-java@v1
with:
java-version: 11
- name: Build and test project
run: mvn -f github-actions-java-maven/pom.xml clean verify
- name: Upload Maven build artifact
uses: actions/upload-artifact@v1
with:
name: artifact
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@v1
- name: Download Maven build artifact
uses: actions/download-artifact@v1
with:
name: artifact
- name: Build Docker container
run: |
mkdir -p github-actions-java-maven/target
mv artifact/github-actions-java-maven.jar github-actions-java-maven/target
docker build -t de.rieckpil.blog/github-actions-sample github-actions-java-maven
- 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)"
You can’t perform that action at this time.