Skip to content

feat(api): add tags #309

feat(api): add tags

feat(api): add tags #309

name: DailyClean Docker Images CI
on:
push:
branches: [ main ]
pull_request:
branches: [ main ]
jobs:
sonar:
environment: dailyclean
name: Sonar Cloud
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Set up JDK 20
uses: actions/setup-java@v2
with:
java-version: '20'
distribution: 'adopt'
cache: maven
- name: Build with Maven
run: mvn --batch-mode --update-snapshots verify
working-directory: ./api/api
- uses: actions/setup-node@v2
with:
node-version: '18'
- name: npm install
run: npm install
working-directory: ./api/web
- name: npm test
run: npm test -- --run
working-directory: ./api/web
- name: SonarCloud Scan
uses: SonarSource/sonarcloud-github-action@master
with:
args: >
-Dsonar.organization=axaguildev
-Dsonar.projectKey=AxaGuilDEv_dailyclean
-Dsonar.java.binaries=api/api/target/classes
-Dsonar.java.libraries=.
-Dsonar.coverage.jacoco.xmlReportPaths=**/target/jacoco-report/jacoco.xml
-Dsonar.javascript.lcov.reportPaths=api/web/coverage/lcov.info
-Dsonar.javascript.file.suffixes=js,jsx
-Dsonar.python.version=3
-Dsonar.exclusions=**/*.spec.js,**/*.stories.js,**/src/coverage/**,**/*.scss,**/__snapshots__/**,**/node_modules/**,**/src/.storybook/**,**/src/storybook-static/**,**/__mocks__/**
-Dsonar.coverage.exclusions=**src/test/**/*.*
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
tags:
runs-on: ubuntu-latest
outputs:
new_version: ${{ steps.tag.outputs.new_version }}
steps:
- uses: actions/checkout@master
- name: Bump version and push tag
id: tag_version
if: github.ref == 'refs/heads/main'
uses: mathieudutour/[email protected]
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
- name: Add tag to output step for main branch
id: tag
run: |
if [ '${{ github.ref }}' = 'refs/heads/main' ]; then
echo "new_version=${{ steps.tag_version.outputs.new_version }}" >> $GITHUB_OUTPUT
else
echo "new_version=pr-${{ github.event.number }}-${{ github.run_number }}" >> $GITHUB_OUTPUT
fi
build_api:
needs: tags
uses: ./.github/workflows/Docker.yml
with:
image_name: "axaguildev/dailyclean-api"
image_version: "${{ needs.tags.outputs.new_version }}"
image_build_args: ""
image_context: ./api
image_file: "./api/Dockerfile"
secrets:
DOCKER_USERNAME: ${{ secrets.DOCKER_USERNAME }}
DOCKER_PASSWORD: ${{ secrets.DOCKER_PASSWORD }}
build_job:
needs: tags
uses: ./.github/workflows/Docker.yml
with:
image_name: "axaguildev/dailyclean-job"
image_version: "${{ needs.tags.outputs.new_version }}"
image_build_args: ""
image_context: ./job/dailyclean
image_file: "./job/dailyclean/Dockerfile"
secrets:
DOCKER_USERNAME: ${{ secrets.DOCKER_USERNAME }}
DOCKER_PASSWORD: ${{ secrets.DOCKER_PASSWORD }}