Skip to content

Removed unneeded config (#2526) #1014

Removed unneeded config (#2526)

Removed unneeded config (#2526) #1014

Workflow file for this run

name: Publish Swagger Specs
on:
push:
branches:
- master
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Cache
uses: actions/cache@v3
with:
path: ~/.gradle/caches
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle') }}
restore-keys: ${{ runner.os }}-gradle-
- name: Set up JDK 17
uses: actions/setup-java@v4
with:
java-version: 17
distribution: 'temurin'
- name: Run Swagger Publisher
run: ./gradlew integration --tests uk.gov.hmcts.reform.sendletter.ApplicationTest
- name: Run Backstage API gen
run: |
echo "$(cat api.yaml)" > /tmp/send-letter-service-api.yaml
echo " $(cat /tmp/swagger-specs.json)" >> /tmp/send-letter-service-api.yaml
- name: Commit to repository
run: |
mkdir swagger-staging
cd swagger-staging
git init
git config user.email "[email protected]"
git config user.name "GitHub action"
git remote add upstream "https://jenkins-reform-hmcts:${{ secrets.SWAGGER_PUBLISHER_API_TOKEN }}@github.com/hmcts/reform-api-docs.git"
git pull upstream master
repo=`echo "$GITHUB_REPOSITORY" | cut -f2- -d/`
mkdir -p docs/specs
mkdir -p docs/backstage
echo "$(cat /tmp/swagger-specs.json)" > "docs/specs/send-letter-service.json"
echo "$(cat /tmp/labs-jackmaloney2-api.yaml)" > "docs/backstage/send-letter-service-api.yaml"
git add "docs/specs/send-letter-service.json"
git add "docs/backstage/send-letter-service-api.yaml"
# Only commit and push if we have changes.
git diff --quiet && git diff --staged --quiet || (git commit -m "Update spec for $repo#${GITHUB_SHA:7}"; git push --set-upstream upstream master)