🤦♂️removed rule to trigger pipeline only on java changes, since CI/C… #37
Workflow file for this run
This file contains hidden or 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: java | |
| on: | |
| push: | |
| branches: | |
| - main | |
| - 1153_finish_ci-cd_configuration | |
| jobs: | |
| build-and-deploy-core: | |
| name: Build and Deploy metrics-core | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Set up JDK 17 | |
| uses: actions/setup-java@v3 | |
| with: | |
| distribution: 'temurin' | |
| java-version: '17' | |
| - name: Configure Maven settings.xml | |
| run: | | |
| mkdir -p ~/.m2 | |
| echo "${{ secrets.MAVEN_SETTINGS }}" | base64 --decode > ~/.m2/settings.xml | |
| - name: Import GPG key | |
| run: | | |
| set +e | |
| echo "$GPG_PRIVATE_KEY" | tr -d '\r' | sed '1s/^\xEF\xBB\xBF//' | sed '/^\s*$/d' | sed 's/^[ \t]*//;s/[ \t]*$//' > clean_gpg_key.asc | |
| gpg --batch --import clean_gpg_key.asc | |
| GPG_EXIT_CODE=$? | |
| set -e | |
| if [ $GPG_EXIT_CODE -ge 3 ]; then | |
| echo "GPG import failed with code $GPG_EXIT_CODE" | |
| exit $GPG_EXIT_CODE | |
| else | |
| echo "GPG key imported successfully" | |
| fi | |
| env: | |
| GPG_PRIVATE_KEY: ${{ secrets.GPG_PRIVATE_KEY }} | |
| - name: Build & Test metrics-core | |
| working-directory: packages/java/metrics-core | |
| run: mvn clean install -Dgpg.passphrase=${{ secrets.GPG_PASSPHRASE }} | |
| - name: List signed artifacts | |
| run: ls -l packages/java/target/*.asc || echo "No .asc files" | |
| - name: Deploy metrics-core | |
| working-directory: packages/java/metrics-core | |
| run: mvn deploy -Dgpg.passphrase=${{ secrets.GPG_PASSPHRASE }} | |
| build-and-deploy-for-spring3: | |
| name: Build and Deploy metrics-spring library for Spring Boot 3+ | |
| needs: build-and-deploy-core | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Set up JDK 17 | |
| uses: actions/setup-java@v3 | |
| with: | |
| distribution: 'temurin' | |
| java-version: '17' | |
| - name: Configure Maven settings.xml | |
| run: | | |
| mkdir -p ~/.m2 | |
| echo "${{ secrets.MAVEN_SETTINGS }}" | base64 --decode > ~/.m2/settings.xml | |
| - name: Import GPG Key | |
| run: | | |
| set +e | |
| echo "$GPG_PRIVATE_KEY" | tr -d '\r' | sed '1s/^\xEF\xBB\xBF//' | sed '/^\s*$/d' | sed 's/^[ \t]*//;s/[ \t]*$//' > clean_gpg_key.asc | |
| gpg --batch --import clean_gpg_key.asc | |
| GPG_EXIT_CODE=$? | |
| set -e | |
| if [ $GPG_EXIT_CODE -ge 3 ]; then | |
| echo "GPG import failed with code $GPG_EXIT_CODE" | |
| exit $GPG_EXIT_CODE | |
| else | |
| echo "GPG key imported successfully" | |
| fi | |
| env: | |
| GPG_PRIVATE_KEY: ${{ secrets.GPG_PRIVATE_KEY }} | |
| - name: Build & Test metrics-spring | |
| working-directory: packages/java/metrics-spring | |
| run: mvn clean verify -Dgpg.passphrase=${{ secrets.GPG_PASSPHRASE }} | |
| - name: Deploy metrics-spring | |
| working-directory: packages/java/metrics-spring | |
| run: mvn deploy -Dgpg.passphrase=${{ secrets.GPG_PASSPHRASE }} | |
| build-and-deploy-for-spring2: | |
| name: Build and Deploy metrics-spring library for Spring Boot 2+ | |
| needs: build-and-deploy-core | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Set up JDK 17 | |
| uses: actions/setup-java@v3 | |
| with: | |
| distribution: 'temurin' | |
| java-version: '17' | |
| - name: Configure Maven settings.xml | |
| run: | | |
| mkdir -p ~/.m2 | |
| echo "${{ secrets.MAVEN_SETTINGS }}" | base64 --decode > ~/.m2/settings.xml | |
| - name: Import GPG Key | |
| run: | | |
| set +e | |
| echo "$GPG_PRIVATE_KEY" | tr -d '\r' | sed '1s/^\xEF\xBB\xBF//' | sed '/^\s*$/d' | sed 's/^[ \t]*//;s/[ \t]*$//' > clean_gpg_key.asc | |
| gpg --batch --import clean_gpg_key.asc GPG_EXIT_CODE=$? | |
| set -e | |
| if [ $GPG_EXIT_CODE -ge 3 ]; then | |
| echo "GPG import failed with code $GPG_EXIT_CODE" | |
| exit $GPG_EXIT_CODE | |
| else | |
| echo "GPG key imported successfully" | |
| fi | |
| env: | |
| GPG_PRIVATE_KEY: ${{ secrets.GPG_PRIVATE_KEY }} | |
| - name: Build & Test metrics-spring2 | |
| working-directory: packages/java/metrics-spring2 | |
| run: mvn clean verify -Dgpg.passphrase=${{ secrets.GPG_PASSPHRASE }} | |
| - name: Deploy metrics-spring2 | |
| working-directory: packages/java/metrics-spring2 | |
| run: mvn deploy -Dgpg.passphrase=${{ secrets.GPG_PASSPHRASE }} | |