fix(release): Setup java 17 in release action (#595) #1663
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: "gradle-actions" | |
on: | |
push: | |
branches: | |
- master | |
- feature/* | |
- fix/* | |
pull_request: | |
branches: | |
- master | |
jobs: | |
build: | |
if: ${{ !contains(github.event.head_commit.message, '[skip ci]') }} | |
permissions: | |
contents: write | |
issues: write | |
pull-requests: write | |
runs-on: ubuntu-latest | |
steps: | |
- name: Harden Runner | |
uses: step-security/harden-runner@0080882f6c36860b6ba35c610c98ce87d4e2f26f # v2.10.2 | |
with: | |
egress-policy: audit | |
- name: Generate a token of Github APP | |
id: generate_token | |
if: github.ref == 'refs/heads/master' | |
uses: tibdex/github-app-token@3beb63f4bd073e61482598c45c71c1019b59b73a # v2.1.0 | |
with: | |
app_id: ${{ secrets.APP_ID_ADMIN_GITHUB }} | |
private_key: ${{ secrets.APP_PRIVATE_KEY_ADMIN_GITHUB }} | |
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 | |
if: github.ref == 'refs/heads/master' | |
with: | |
token: ${{ steps.generate_token.outputs.token }} | |
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 | |
if: github.ref != 'refs/heads/master' | |
- name: Verify Conventional Commits | |
uses: amannn/action-semantic-pull-request@0723387faaf9b38adef4775cd42cfd5155ed6017 # v5.5.3 | |
if: github.event_name == 'pull_request' || github.event_name == 'pull_request_target' | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- name: Set up NodeJS | |
if: github.ref == 'refs/heads/master' | |
uses: actions/setup-node@1e60f620b9541d16bece96c5465dc8ee9832be0b # v4.0.3 | |
with: | |
node-version-file: '.nvmrc' | |
- name: Set up Semantic Release | |
if: github.ref == 'refs/heads/master' | |
run: npm -g install @semantic-release/git [email protected] | |
- name: Semantic Release | |
if: github.ref == 'refs/heads/master' | |
run: npx [email protected] | |
env: | |
GITHUB_TOKEN: ${{ steps.generate_token.outputs.token }} | |
- name: Set up JDK 17 | |
uses: actions/setup-java@8df1039502a15bceb9433410b1a100fbe190c53b # v4.5.0 | |
with: | |
distribution: 'temurin' | |
java-version: 17 | |
- name: Validate code formatting | |
run: ./gradlew verGJF | |
- name: Execute build test and report | |
run: ./gradlew jacocoTestReport --refresh-dependencies --no-daemon --continue | |
- name: copy the reportTest to codeCoverage | |
run: cp build/reports/jacoco/report.xml jacoco.xml || echo "Code coverage failed" | |
- name: Push codeCoverage to Codecov | |
run: bash <(curl -s https://codecov.io/bash) | |
- name: Run sonar | |
if: github.event.pull_request.head.repo.fork == false && github.event.pull_request.head.ref != 'dependabot/**' | |
run: ./gradlew sonar --stacktrace | |
-Dsonar.token=${{ secrets.SONAR_TOKEN }} | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
# Next steps will only run if generation code templates have been changed | |
- name: Detect changes in generated code | |
uses: dorny/paths-filter@de90cc6fb38fc0963ad72b210f1f284cd68cea36 # v3.0.2 | |
id: changes | |
with: | |
filters: | | |
templates: | |
- 'src/main/resources/**' | |
- 'src/main/java/co/com/bancolombia/Constants.java' | |
- 'src/main/java/co/com/bancolombia/factory/**' | |
# Generated code Analysis | |
- name: Publish local | |
if: steps.changes.outputs.templates == 'true' | |
run: ./sh_publish_plugin_local.sh | |
# Generated code reactive | |
- name: Generate reactive project to scan | |
if: steps.changes.outputs.templates == 'true' | |
run: ./sh_generate_project.sh reactive | |
- name: Scan generated reactive project dependencies | |
if: steps.changes.outputs.templates == 'true' | |
working-directory: ./build/toscan/reactive | |
run: ./gradlew build it | |
# run: ./gradlew build dependencyCheckAnalyze && ./gradlew it && cat applications/app-service/build/reports/dependency-check-sonar.json | |
- name: Sonar analysis for generated reactive project | |
if: github.event.pull_request.head.repo.fork == false && steps.changes.outputs.templates == 'true' | |
working-directory: ./build/toscan/reactive | |
run: ./gradlew sonar --stacktrace | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} | |
# Generated code imperative | |
- name: Generate imperative project to scan | |
if: steps.changes.outputs.templates == 'true' | |
run: ./sh_generate_project.sh imperative | |
- name: Scan generated imperative project dependencies | |
if: steps.changes.outputs.templates == 'true' | |
working-directory: ./build/toscan/imperative | |
run: ./gradlew build it | |
# run: ./gradlew build dependencyCheckAnalyze && ./gradlew it && cat applications/app-service/build/reports/dependency-check-sonar.json | |
- name: Sonar analysis for generated imperative project | |
if: github.event.pull_request.head.repo.fork == false && steps.changes.outputs.templates == 'true' | |
working-directory: ./build/toscan/imperative | |
run: ./gradlew sonar --stacktrace | |
-Dsonar.token=${{ secrets.SONAR_TOKEN_GENERATED_I }} | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |