Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/actions/can-i-deploy/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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.'
Expand Down
23 changes: 11 additions & 12 deletions .github/workflows/consumer.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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: >
Expand All @@ -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 }}
Expand All @@ -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'
Expand All @@ -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'
Expand Down
19 changes: 10 additions & 9 deletions .github/workflows/student-provider.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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: >
Expand All @@ -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
Expand All @@ -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'
Expand All @@ -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'
Expand Down
24 changes: 12 additions & 12 deletions .github/workflows/teacher-provider.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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: >
Expand All @@ -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:
Expand All @@ -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'
Expand All @@ -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'
Expand Down