ci(task-nr): remove commented code #36
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/CD | |
on: | |
pull_request: | |
types: [opened, synchronize, reopened] | |
branches: | |
- main | |
- master | |
release: | |
types: [published] | |
concurrency: | |
group: ${{ github.ref }} | |
cancel-in-progress: true | |
env: | |
TAG_VERSION: >- | |
${{ | |
github.event_name == 'published' && | |
github.event.release.tag_name | |
|| | |
github.sha | |
}} | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Set up JDK 17 | |
uses: actions/setup-java@v2 | |
with: | |
distribution: 'adopt' | |
java-version: '17' | |
- name: Compile | |
run: | | |
echo "Compiling the code" | |
./mvnw compile | |
- name: Test | |
run: | | |
echo "Running the tests" | |
./mvnw test | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v3 | |
- name: Login to Docker Hub | |
uses: docker/login-action@v1 | |
with: | |
username: ${{ secrets.DOCKER_USERNAME }} | |
password: ${{ secrets.DOCKER_PASSWORD }} | |
- name: Extract metadata (tags, labels) for Docker | |
uses: docker/metadata-action@v3 | |
with: | |
images: ${{ github.event.repository.name }}:${{ env.TAG_VERSION }} | |
- name: Build and push image | |
uses: docker/build-push-action@v5 | |
with: | |
context: . | |
file: Dockerfile | |
push: true | |
tags: ${{ secrets.DOCKER_USERNAME }}/${{ github.event.repository.name }}:${{ env.TAG_VERSION }} | |
deploy: | |
if: (github.event_name == 'pull_request' && github.event.action == 'closed' && github.event.pull_request.merged == true) || | |
(github.event_name == 'release' && github.event.action == 'published') | |
runs-on: ubuntu-latest | |
needs: build | |
steps: | |
- name: Deploy | |
run: | | |
echo "Deploying the app using ${{ github.event.repository.name }}:${{ env.TAG_VERSION }} image" |