Skip to content

chore(deps): Bump native-buildtools.version from 0.9.20 to 0.10.2 #39

chore(deps): Bump native-buildtools.version from 0.9.20 to 0.10.2

chore(deps): Bump native-buildtools.version from 0.9.20 to 0.10.2 #39

name: API deployment
env:
IMAGE_NAME: uuhnaut69/api-service
VERSION: ${{ github.sha }}
on:
push:
branches: [ "master" ]
pull_request:
branches: [ "master" ]
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Set up JDK 11
uses: actions/setup-java@v3
with:
java-version: '11'
distribution: 'temurin'
cache: maven
- name: Build with Maven
run: mvn -B package --file pom.xml -DskipTests=true
package:
needs: [ build ]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Set up JDK 19
uses: actions/setup-java@v3
with:
java-version: '19'
distribution: 'temurin'
cache: maven
- name: Login to Docker Hub
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Build docker image
run: mvn spring-boot:build-image --file pom.xml -DskipTests=true -Dspring-boot.build-image.imageName=${{ env.IMAGE_NAME }}:${{ env.VERSION }}
- name: Publish container image
run: docker push ${{ env.IMAGE_NAME }}:${{ env.VERSION }}
- name: Publish container image (latest)
run: |
docker tag ${{ env.IMAGE_NAME }}:${{ env.VERSION }} ${{ env.IMAGE_NAME }}:latest
docker push ${{ env.IMAGE_NAME }}:latest