diff --git a/.github/actions/can-i-deploy/action.yml b/.github/actions/can-i-deploy/action.yml index 444910a..7f1f197 100644 --- a/.github/actions/can-i-deploy/action.yml +++ b/.github/actions/can-i-deploy/action.yml @@ -12,7 +12,7 @@ inputs: description: 'The version of the component to check (e.g., commit SHA).' required: true environment: - description: 'The target environment for the check (e.g., DEV, PROD).' + description: 'The target environment for the check (e.g., test, production).' required: true pact_broker_token: description: 'The authentication token for the Pact Broker.' diff --git a/.github/workflows/consumer.yml b/.github/workflows/consumer.yml index ece8f1b..cf99d82 100644 --- a/.github/workflows/consumer.yml +++ b/.github/workflows/consumer.yml @@ -4,11 +4,11 @@ on: workflow_dispatch: inputs: environment: - description: "Environment to deploy to. Select 'NONE' for build only." + description: "Environment to deploy to. Select 'none' for build only." required: true type: choice - default: 'NONE' - options: [ NONE, DEV, PRE, PROD ] + default: 'none' + options: [ none, test, production ] env: MAVEN_CLI_OPTS: > @@ -34,15 +34,14 @@ jobs: needs: build runs-on: ubuntu-latest steps: - # Pasos 1: Preparar el entorno una sola vez - name: Checkout repository code uses: actions/checkout@v4 + - name: Setup Pact CLI uses: ./.github/actions/pact-cli-setup - # Paso 2: Ejecutar la secuencia de acciones - name: Publish Contract to Pact Broker - uses: ./.github/actions/publish-contract/action.yml + uses: ./.github/actions/publish-contract with: pact_broker_base_url: ${{ vars.PACT_BROKER_BASE_URL }} consumer_version: ${{ github.sha }} @@ -51,8 +50,8 @@ jobs: pact_broker_token: ${{ secrets.PACTFLOW_TOKEN }} - name: Can I Deploy? - if: github.event.inputs.environment != 'NONE' - uses: ./.github/actions/can-i-deploy/action.yml + if: github.event.inputs.environment != 'none' + uses: ./.github/actions/can-i-deploy with: pact_broker_base_url: ${{ vars.PACT_BROKER_BASE_URL }} pacticipant: 'consumer' @@ -61,16 +60,16 @@ jobs: pact_broker_token: ${{ secrets.PACTFLOW_TOKEN }} - name: Deploy - if: github.event.inputs.environment != 'NONE' - uses: ./.github/actions/deploy/action.yml + if: github.event.inputs.environment != 'none' + uses: ./.github/actions/deploy with: pacticipant: 'consumer' version: ${{ github.sha }} environment: ${{ github.event.inputs.environment }} - name: Tag Deployment - if: github.event.inputs.environment != 'NONE' - uses: ./.github/actions/tagging/action.yml + if: github.event.inputs.environment != 'none' + uses: ./.github/actions/tagging with: pact_broker_base_url: ${{ vars.PACT_BROKER_BASE_URL }} pacticipant: 'consumer' diff --git a/.github/workflows/student-provider.yml b/.github/workflows/student-provider.yml index 5568c6d..fae564d 100644 --- a/.github/workflows/student-provider.yml +++ b/.github/workflows/student-provider.yml @@ -4,11 +4,11 @@ on: workflow_dispatch: inputs: environment: - description: "Environment to deploy to. Select 'NONE' for build only." + description: "Environment to deploy to. Select 'none' for build only." required: true type: choice - default: 'NONE' - options: [ NONE, DEV, PRE, PROD ] + default: 'none' + options: [ none, test, production ] env: MAVEN_CLI_OPTS: > @@ -22,21 +22,22 @@ jobs: steps: - uses: actions/checkout@v4 - uses: actions/setup-java@v4 - with: { distribution: 'temurin', java-version: '17', cache: 'maven' } + with: { distribution: 'temurin', java-version: '21', cache: 'maven' } - name: Build and Verify with Maven env: PACT_BROKER_BASE_URL: ${{ vars.PACT_BROKER_BASE_URL }} + PACT_BROKER_TOKEN: ${{ secrets.PACTFLOW_TOKEN }} run: > mvn -f student-provider/pom.xml $MAVEN_CLI_OPTS clean install -Dpact.verifier.publishResults=true -Dpact.provider.version=${{ github.sha }} -Dpact.provider.branch=${{ github.ref_name }} - -Dpactbroker.consumerversionselectors.rawjson='[{"deployedOrReleased":true}, {"matchingBranch": true}]' + -Dpactbroker.consumerversionselectors.rawjson='[{"deployed":true}, {"latest":true}]' deploy_sequence: name: Deploy needs: build_and_verify - if: github.event.inputs.environment != 'NONE' + if: github.event.inputs.environment != 'none' runs-on: ubuntu-latest steps: - name: Checkout repository code @@ -45,7 +46,7 @@ jobs: uses: ./.github/actions/pact-cli-setup - name: Can I Deploy? - uses: ./.github/actions/can-i-deploy/action.yml + uses: ./.github/actions/can-i-deploy with: pact_broker_base_url: ${{ vars.PACT_BROKER_BASE_URL }} pacticipant: 'student-provider' @@ -54,14 +55,14 @@ jobs: pact_broker_token: ${{ secrets.PACTFLOW_TOKEN }} - name: Deploy - uses: ./.github/actions/deploy/action.yml + uses: ./.github/actions/deploy with: pacticipant: 'student-provider' version: ${{ github.sha }} environment: ${{ github.event.inputs.environment }} - name: Tag Deployment - uses: ./.github/actions/tagging/action.yml + uses: ./.github/actions/tagging with: pact_broker_base_url: ${{ vars.PACT_BROKER_BASE_URL }} pacticipant: 'student-provider' diff --git a/.github/workflows/teacher-provider.yml b/.github/workflows/teacher-provider.yml index 60dbb5c..9dfc025 100644 --- a/.github/workflows/teacher-provider.yml +++ b/.github/workflows/teacher-provider.yml @@ -4,11 +4,11 @@ on: workflow_dispatch: inputs: environment: - description: "Environment to deploy to. Select 'NONE' for build only." + description: "Environment to deploy to. Select 'none' for build only." required: true type: choice - default: 'NONE' - options: [ NONE, DEV, PRE, PROD ] + default: 'none' + options: [ none, test, production ] env: MAVEN_CLI_OPTS: > @@ -22,7 +22,7 @@ jobs: steps: - uses: actions/checkout@v4 - uses: actions/setup-java@v4 - with: { distribution: 'temurin', java-version: '17', cache: 'maven' } + with: { distribution: 'temurin', java-version: '21', cache: 'maven' } - run: mvn -f teacher-provider/pom.xml $MAVEN_CLI_OPTS clean install - uses: actions/upload-artifact@v4 with: @@ -45,21 +45,21 @@ jobs: uses: ./.github/actions/pact-cli-setup - name: Publish OpenAPI Specification - uses: ./.github/actions/publish-openapi/action.yml + uses: ./.github/actions/publish-openapi with: pact_broker_base_url: ${{ vars.PACT_BROKER_BASE_URL }} provider_name: 'teacher-provider' provider_version: ${{ github.sha }} branch_name: ${{ github.ref_name }} openapi_artifact_name: 'openapi-spec' - openapi_file_path: 'teacher-provider/target/openapi.yaml' + openapi_file_path: 'openapi.yaml' verification_artifact_name: 'verification-results' verification_file_path: 'verification-results.txt' pact_broker_token: ${{ secrets.PACTFLOW_TOKEN }} - name: Can I Deploy? - if: github.event.inputs.environment != 'NONE' - uses: ./.github/actions/can-i-deploy/action.yml + if: github.event.inputs.environment != 'none' + uses: ./.github/actions/can-i-deploy with: pact_broker_base_url: ${{ vars.PACT_BROKER_BASE_URL }} pacticipant: 'teacher-provider' @@ -68,16 +68,16 @@ jobs: pact_broker_token: ${{ secrets.PACTFLOW_TOKEN }} - name: Deploy - if: github.event.inputs.environment != 'NONE' - uses: ./.github/actions/deploy/action.yml + if: github.event.inputs.environment != 'none' + uses: ./.github/actions/deploy with: pacticipant: 'teacher-provider' version: ${{ github.sha }} environment: ${{ github.event.inputs.environment }} - name: Tag Deployment - if: github.event.inputs.environment != 'NONE' - uses: ./.github/actions/tagging/action.yml + if: github.event.inputs.environment != 'none' + uses: ./.github/actions/tagging with: pact_broker_base_url: ${{ vars.PACT_BROKER_BASE_URL }} pacticipant: 'teacher-provider'