Skip to content

better cach

better cach #27

name: Java CI/CD
on:
pull_request:
branches: [ main ]
paths:
- 'BackSimulation/**'
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Set up JDK 17
uses: actions/setup-java@v2
with:
java-version: '17'
distribution: 'adopt'
- name: Build with Maven
run: cd BackSimulation && mvn clean package
- name: Upload JAR file
uses: actions/upload-artifact@v2
with:
name: backsimulation-jar
path: BackSimulation/target/BackSimulation-0.0.1-SNAPSHOT.jar
dockerize:
runs-on: ubuntu-latest
needs: build
steps:
- uses: actions/checkout@v2
- name: Download JAR file
uses: actions/download-artifact@v2
with:
name: backsimulation-jar
path: BackSimulation/target
- name: Login to Docker Hub
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKER_HUB_USERNAME }}
password: ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }}
- name: Build and Push Docker Image
uses: docker/build-push-action@v2
with:
push: true
tags: siliataider/backsimulation:latest
context: .
file: ./BackSimulation/Dockerfile
deploy:
runs-on: ubuntu-latest
needs: dockerize
steps:
- uses: actions/checkout@v2
- name: Deploy to Render
run: >
curl -X POST -H 'Authorization: Bearer ${{ secrets.RENDER_API_KEY }}' -d ''
https://api.render.com/deploy/srv-cmj4au6n7f5s73a7dvu0?key=a578AouEmQE