This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Build and Deploy to Production | |
on: | |
pull_request: | |
branches: | |
- main | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Set up JDK 21 | |
uses: actions/setup-java@v4.2.1 | |
with: | |
java-version: '21' | |
distribution: 'corretto' | |
- name: Build with Maven | |
run: mvn clean package | |
- name: Log in to Docker Hub | |
run: docker login -u ${{ secrets.DOCKER_USERNAME }} -p ${{ secrets.DOCKER_PASSWORD }} | |
- name: Build Docker image | |
run: | | |
docker build -t ms-ocr . | |
docker tag ms-ocr ${{ secrets.DOCKER_USERNAME }}/ms-ocr:production | |
docker push ${{ secrets.DOCKER_USERNAME }}/ms-ocr:production | |
deploy: | |
runs-on: ubuntu-latest | |
needs: [build] | |
steps: | |
- name: Deploy to Production | |
uses: johnbeynon/render-deploy-action@v0.0.8 | |
with: | |
service-id: ${{ secrets.MY_RENDER_SERVICE_ID }} | |
api-key: ${{ secrets.MY_RENDER_API_KEY }} |