Skip to content

updated EnvironmentParameters -> EnvironmentParameters and CI (#657) #152

updated EnvironmentParameters -> EnvironmentParameters and CI (#657)

updated EnvironmentParameters -> EnvironmentParameters and CI (#657) #152

name: Build specifications, schemas and comparisions
on:
push:
workflow_dispatch:
jobs:
check:
runs-on: ubuntu-latest
outputs:
skip_job: ${{ steps.skip.outputs.skip_job }}
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Check last commit message
id: commit-message
run: |
echo "COMMIT_MESSAGE=$(git log -1 --pretty=format:'%s')" >> "$GITHUB_ENV"
echo "skip_job=false" >> "$GITHUB_OUTPUT"
- id: skip
name: Skip if automated push
if: contains(env.COMMIT_MESSAGE, 'Apply automatic changes')
run: |
echo "Automated commit detected - skipping job"
echo "skip_job=true" >> "$GITHUB_OUTPUT"
- name: Check Branch with Regex
id: check-tag
run: |
if [ "${{ github.ref }}" =~ ^refs/heads/brapi-V[0-9]+\.[0-9]+$ ]; then
echo "commit=true" >> $GITHUB_ENV
else
echo "commit=false" >> $GITHUB_ENV
fi
if [[env.commit == 'true']]; then
echo "Release branch - will commit generated files"
else
echo "Feature branch - will NOT commit generated files"
fi
generate:
runs-on: ubuntu-latest
needs: check
if: needs.check.outputs.skip_job != 'true'
steps:
- name: debug
run: echo ${{ needs.check.outputs.skip_job }}
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0
ssh-key: ${{ secrets.DEPLOY_KEY }}
- name: Set up Docker Compose
uses: docker/setup-compose-action@v1
- name: Build and run the Docker image
working-directory: ./docker
run: docker compose run build-docs
- name: Convert compiled specification
working-directory: ./docker
run: docker compose run gen-swagger
- name: Set up JDK 21
uses: actions/setup-java@v4
with:
java-version: '22'
distribution: 'temurin'
- name: Change wrapper permissions
working-directory: ./generator
run: chmod +x ./gradlew
- name: Copy compiled specification
working-directory: ./generator
run: ./gradlew copyOpenApi
- name: Validate
working-directory: ./generator
run: ./gradlew validate
- name: Generate OpenAPI, GraphQL and OWL
working-directory: ./generator
run: ./gradlew generateAll
- name: Compare OpenAPI
working-directory: ./generator
run: ./gradlew compareAll
- if: env.commit == 'true'
uses: stefanzweifel/git-auto-commit-action@v5