save #14
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: CI Workflow | |
on: [push] | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v2 | |
with: | |
fetch-depth: 1 | |
- name: Set up Git for sparse checkout | |
run: | | |
git config core.sparseCheckout true | |
echo "RunningService/" >> .git/info/sparse-checkout | |
git read-tree -mu HEAD | |
- name: Set up JDK | |
uses: actions/setup-java@v2 | |
with: | |
distribution: 'temurin' | |
java-version: '17' | |
- name: Build RunningService | |
working-directory: RunningService | |
run: ./mvnw clean install -DskipTests | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v2 | |
- name: Log in to Docker Hub | |
uses: docker/login-action@v2 | |
with: | |
username: ${{ secrets.DOCKER_HUB_USERNAME }} | |
password: ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }} | |
- name: Build Docker image with date tag | |
working-directory: RunningService | |
run: | | |
IMAGE_TAG=last-$(date +'%Y-%m-%d') | |
docker build -t reene44444/runningservice:$IMAGE_TAG . | |
- name: Push Docker image | |
run: | | |
IMAGE_TAG=last-$(date +'%Y-%m-%d') | |
docker push reene44444/runningservice:$IMAGE_TAG |