Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

gha. automate build #222

Merged
merged 24 commits into from
Dec 10, 2024
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
4 changes: 4 additions & 0 deletions .github/workflows/make-prs-for-client-repos.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,27 +30,31 @@ jobs:
run: gh pr create --base ${{ inputs.target_branch }} --head ${{ inputs.source_branch }} --title '[GitHub Actions] Merge ${{ inputs.source_branch }} -> ${{ inputs.target_branch }}' --label OpenAPI --body 'Autogenerated Pull Request triggered by Github Actions in OpenAPI repository' --repo regulaforensics/DocumentReader-web-python-client
env:
GITHUB_TOKEN: ${{ secrets.REGULA_GITHUB_PUSH_TOKEN }}

java-webclient-pr:
runs-on: ubuntu-latest
steps:
- name: Create PR for Java WebClient Repo
run: gh pr create --base ${{ inputs.target_branch }} --head ${{ inputs.source_branch }} --title '[GitHub Actions] Merge ${{ inputs.source_branch }} -> ${{ inputs.target_branch }}' --label OpenAPI --body 'Autogenerated Pull Request triggered by Github Actions in OpenAPI repository' --repo regulaforensics/DocumentReader-web-java-client
env:
GITHUB_TOKEN: ${{ secrets.REGULA_GITHUB_PUSH_TOKEN }}

js-webclient-pr:
runs-on: ubuntu-latest
steps:
- name: Create PR for JS WebClient Repo
run: gh pr create --base ${{ inputs.target_branch }} --head ${{ inputs.source_branch }} --title '[GitHub Actions] Merge ${{ inputs.source_branch }} -> ${{ inputs.target_branch }}' --label OpenAPI --body 'Autogenerated Pull Request triggered by Github Actions in OpenAPI repository' --repo regulaforensics/DocumentReader-web-js-client
env:
GITHUB_TOKEN: ${{ secrets.REGULA_GITHUB_PUSH_TOKEN }}

csharp-webclient-pr:
runs-on: ubuntu-latest
steps:
- name: Create PR for CSharp WebClient Repo
run: gh pr create --base ${{ inputs.target_branch }} --head ${{ inputs.source_branch }} --title '[GitHub Actions] Merge ${{ inputs.source_branch }} -> ${{ inputs.target_branch }}' --label OpenAPI --body 'Autogenerated Pull Request triggered by Github Actions in OpenAPI repository' --repo regulaforensics/DocumentReader-web-csharp-client
env:
GITHUB_TOKEN: ${{ secrets.REGULA_GITHUB_PUSH_TOKEN }}

openapi-pr:
runs-on: ubuntu-latest
steps:
Expand Down
65 changes: 0 additions & 65 deletions .github/workflows/release-web-page.yml

This file was deleted.

81 changes: 56 additions & 25 deletions .github/workflows/update-clients.yml
Original file line number Diff line number Diff line change
@@ -1,136 +1,167 @@
name: update clients

on:
push:
branches: [develop]
workflow_dispatch:
inputs:
title:
description: "Title For PR's"
required: true

jobs:
title:
runs-on: ubuntu-latest
outputs:
title: ${{ steps.get-title.outputs.fmt_title }}
steps:
- id: get-title
run: |
if [[ ${{ github.event_name }} == 'workflow_dispatch' ]]; then
echo "fmt_title=${{ github.event.inputs.title }}" >> "$GITHUB_OUTPUT"
else
echo "fmt_title=${{ github.event.head_commit.message }}" >> "$GITHUB_OUTPUT"
fi

update-js-client:
needs: title
runs-on: ubuntu-latest
steps:
- name: Checkout Specification Repo
uses: actions/checkout@v4
with:
path: 'DocumentReader-web-openapi'
ref: 'develop'
path: "DocumentReader-web-openapi"
ref: "develop"

- name: Checkout JS Client Repo
uses: actions/checkout@v4
with:
repository: 'regulaforensics/DocumentReader-web-js-client'
repository: "regulaforensics/DocumentReader-web-js-client"
token: ${{ secrets.REGULA_GITHUB_PUSH_TOKEN }}
path: 'js-client'
ref: 'develop'
path: "js-client"
ref: "develop"

- name: Update Model According To Specification
working-directory: js-client
run: |
npm install
./update-models.sh

- name: Push Changes Back To Client Repo
working-directory: js-client
run: |
git checkout -b ${GITHUB_SHA::8}
git config --local user.email "[email protected]"
git config --local user.name "GitHub Action"
git add --all
git commit -m "${{ github.event.inputs.title }}" -a
git commit -m "${{ needs.title.outputs.title }}" -a
git push --set-upstream origin ${GITHUB_SHA::8}
gh pr create --fill --draft --base develop
env:
GITHUB_TOKEN: ${{ secrets.REGULA_GITHUB_PUSH_TOKEN }}

update-java-client:
needs: title
runs-on: ubuntu-latest
steps:
- name: Specify Java Version
uses: actions/setup-java@v1
uses: actions/setup-java@v4
with:
distribution: "zulu"
java-version: 11
java-package: jdk

- name: Checkout Specification Repo
uses: actions/checkout@v4
with:
path: 'DocumentReader-web-openapi'
ref: 'develop'
path: "DocumentReader-web-openapi"
ref: "develop"

- name: Checkout Java Client Repo
uses: actions/checkout@v4
with:
repository: 'regulaforensics/DocumentReader-web-java-client'
repository: "regulaforensics/DocumentReader-web-java-client"
token: ${{ secrets.REGULA_GITHUB_PUSH_TOKEN }}
path: 'java-client'
ref: 'develop'
path: "java-client"
ref: "develop"

- name: Update Model According To Specification
working-directory: java-client
run: |
./update-models.sh

- name: Push Changes Back To Client Repo
working-directory: java-client
run: |
git checkout -b ${GITHUB_SHA::8}
git config --local user.email "[email protected]"
git config --local user.name "GitHub Action"
git add --all
git commit -m "${{ github.event.inputs.title }}" -a
git commit -m "${{ needs.title.outputs.title }}" -a
git push --set-upstream origin ${GITHUB_SHA::8}
gh pr create --fill --draft --base develop
env:
GITHUB_TOKEN: ${{ secrets.REGULA_GITHUB_PUSH_TOKEN }}

update-python-client:
needs: title
runs-on: ubuntu-latest
steps:
- name: Checkout Specification Repo
uses: actions/checkout@v4
with:
path: 'DocumentReader-web-openapi'
ref: 'develop'
path: "DocumentReader-web-openapi"
ref: "develop"

- name: Checkout Python Client Repo
uses: actions/checkout@v4
with:
repository: 'regulaforensics/DocumentReader-web-python-client'
repository: "regulaforensics/DocumentReader-web-python-client"
token: ${{ secrets.REGULA_GITHUB_PUSH_TOKEN }}
path: 'python-client'
ref: 'develop'
path: "python-client"
ref: "develop"

- name: Update Model According To Specification
working-directory: python-client
run: |
./update-models.sh

- name: Push Changes Back To Client Repo
working-directory: python-client
run: |
git checkout -b ${GITHUB_SHA::8}
git config --local user.email "[email protected]"
git config --local user.name "GitHub Action"
git add --all
git commit -m "${{ github.event.inputs.title }}" -a
git commit -m "${{ needs.title.outputs.title }}" -a
git push --set-upstream origin ${GITHUB_SHA::8}
gh pr create --fill --draft --base develop
env:
GITHUB_TOKEN: ${{ secrets.REGULA_GITHUB_PUSH_TOKEN }}

update-csharp-client:
needs: title
runs-on: ubuntu-latest
steps:
- name: Checkout Specification Repo
uses: actions/checkout@v4
with:
path: 'DocumentReader-web-openapi'
ref: 'develop'
path: "DocumentReader-web-openapi"
ref: "develop"

- name: Checkout C# Client Repo
uses: actions/checkout@v4
with:
repository: 'regulaforensics/DocumentReader-web-csharp-client'
repository: "regulaforensics/DocumentReader-web-csharp-client"
token: ${{ secrets.REGULA_GITHUB_PUSH_TOKEN }}
path: 'csharp-client'
ref: 'develop'
path: "csharp-client"
ref: "develop"

- name: Update Model According To Specification
working-directory: csharp-client
run: |
./update-models.sh

- name: Push Changes Back To Client Repo
working-directory: csharp-client
run: |
Expand All @@ -139,7 +170,7 @@ jobs:
git config --local user.name "GitHub Action"
git checkout src/Regula.DocumentReader.WebClient/Api/DefaultApi.cs src/Regula.DocumentReader.WebClient/Api/ProcessApi.cs
git add --all
git commit -m "${{ github.event.inputs.title }}" -a
git commit -m "${{ needs.title.outputs.title }}" -a
git push --set-upstream origin ${GITHUB_SHA::8}
gh pr create --fill --draft --base develop
env:
Expand Down
16 changes: 11 additions & 5 deletions .github/workflows/validate-spec.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,16 +11,22 @@ jobs:
validate-specification:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v1
- name: Checkout
uses: actions/checkout@v4

- name: Setup Node
uses: actions/setup-node@v4
with:
node-version: 14
registry-url: https://registry.npmjs.org/
- run: |

- name: Install redoc
run: |
npm install -g redoc-cli
redoc-cli bundle index.yml
- if: ${{ false }}

- name: Revert changes
if: ${{ false }}
run: |
npm install -g @openapitools/openapi-generator-cli
openapi-generator-cli validate -i index.yml

Loading
Loading