From 19e892f6125d39c34e51f17f020828cafba02a11 Mon Sep 17 00:00:00 2001 From: PavelSinelnik Date: Tue, 25 Jun 2024 16:07:14 +0300 Subject: [PATCH 01/10] add test actions --- .github/workflows/automatic-2.yml | 19 +++++++++++++++++++ .github/workflows/manual-1.yml | 27 +++++++++++++++++++++++++++ 2 files changed, 46 insertions(+) create mode 100644 .github/workflows/automatic-2.yml create mode 100644 .github/workflows/manual-1.yml diff --git a/.github/workflows/automatic-2.yml b/.github/workflows/automatic-2.yml new file mode 100644 index 0000000..70b973e --- /dev/null +++ b/.github/workflows/automatic-2.yml @@ -0,0 +1,19 @@ +name: automatic-2 + +on: + repository_dispatch: + types: [manual-Version] + +jobs: + build-and-push: + runs-on: ubuntu-20.04 + steps: + - name: Checkout Specifications + uses: actions/checkout@v2 + with: + path: 'master-branch' + + - name: test + working-directory: master-branch + run: | + echo ${{ github.event.client_payload }} diff --git a/.github/workflows/manual-1.yml b/.github/workflows/manual-1.yml new file mode 100644 index 0000000..95ea051 --- /dev/null +++ b/.github/workflows/manual-1.yml @@ -0,0 +1,27 @@ +name: manual-1 + +on: + workflow_dispatch: + inputs: + version: + description: "Version" + required: true + options: + description: "Possible options: --prerelease" + required: false + default: "" + +jobs: + + release-clients: + runs-on: ubuntu-latest + steps: + - name: Manual 1 + run: | + echo ${{github.event.inputs.version}} + + - name: Repository Dispatch + uses: peter-evans/repository-dispatch@v3 + with: + event-type: manual-Version + client-payload: ${{github.event.inputs.version}} From d8cb9fd4b551a4fe9dc7fb100a38edf2f7e14046 Mon Sep 17 00:00:00 2001 From: PavelSinelnik Date: Tue, 25 Jun 2024 16:12:03 +0300 Subject: [PATCH 02/10] change triggers for existing jobs --- .github/workflows/manual-1.yml | 2 ++ .github/workflows/validate-spec.yml | 2 +- .github/workflows/verify-clients.yml | 2 +- 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/.github/workflows/manual-1.yml b/.github/workflows/manual-1.yml index 95ea051..a07e6ec 100644 --- a/.github/workflows/manual-1.yml +++ b/.github/workflows/manual-1.yml @@ -1,6 +1,8 @@ name: manual-1 on: + pull_request: + branches: [master] workflow_dispatch: inputs: version: diff --git a/.github/workflows/validate-spec.yml b/.github/workflows/validate-spec.yml index 2e430b1..fd317c8 100644 --- a/.github/workflows/validate-spec.yml +++ b/.github/workflows/validate-spec.yml @@ -1,7 +1,7 @@ name: validate specification on: - pull_request: + push: branches: - master diff --git a/.github/workflows/verify-clients.yml b/.github/workflows/verify-clients.yml index b624143..c924a58 100644 --- a/.github/workflows/verify-clients.yml +++ b/.github/workflows/verify-clients.yml @@ -1,7 +1,7 @@ name: verify clients on: - pull_request: + push: branches: - master From f1a67e91fd9323b03cc0317be479e3232c8b9607 Mon Sep 17 00:00:00 2001 From: PavelSinelnik Date: Tue, 25 Jun 2024 16:14:15 +0300 Subject: [PATCH 03/10] add json format to values var --- .github/workflows/automatic-2.yml | 2 +- .github/workflows/manual-1.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/automatic-2.yml b/.github/workflows/automatic-2.yml index 70b973e..76176e7 100644 --- a/.github/workflows/automatic-2.yml +++ b/.github/workflows/automatic-2.yml @@ -16,4 +16,4 @@ jobs: - name: test working-directory: master-branch run: | - echo ${{ github.event.client_payload }} + echo ${{ github.event.client_payload.version }} diff --git a/.github/workflows/manual-1.yml b/.github/workflows/manual-1.yml index a07e6ec..5aebe91 100644 --- a/.github/workflows/manual-1.yml +++ b/.github/workflows/manual-1.yml @@ -26,4 +26,4 @@ jobs: uses: peter-evans/repository-dispatch@v3 with: event-type: manual-Version - client-payload: ${{github.event.inputs.version}} + client-payload: '{"version": "${{github.event.inputs.version}}"}' From f7e8d129f25527c8ab3e1b93a295545f2a213a0a Mon Sep 17 00:00:00 2001 From: PavelSinelnik Date: Tue, 25 Jun 2024 16:16:00 +0300 Subject: [PATCH 04/10] change synt yaml --- .github/workflows/automatic-2.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/automatic-2.yml b/.github/workflows/automatic-2.yml index 76176e7..587c487 100644 --- a/.github/workflows/automatic-2.yml +++ b/.github/workflows/automatic-2.yml @@ -1,8 +1,8 @@ name: automatic-2 on: - repository_dispatch: - types: [manual-Version] + repository_dispatch: + types: [manual-Version] jobs: build-and-push: From f986146ba6b7013af07ee54be104034ce0f2678d Mon Sep 17 00:00:00 2001 From: PavelSinelnik Date: Tue, 25 Jun 2024 16:32:07 +0300 Subject: [PATCH 05/10] trigger new actions --- .github/workflows/automatic-2.yml | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/.github/workflows/automatic-2.yml b/.github/workflows/automatic-2.yml index 587c487..1a46413 100644 --- a/.github/workflows/automatic-2.yml +++ b/.github/workflows/automatic-2.yml @@ -1,8 +1,10 @@ name: automatic-2 on: - repository_dispatch: - types: [manual-Version] + pull_request: + branches: [master] +# repository_dispatch: +# types: [manual-Version] jobs: build-and-push: @@ -13,7 +15,7 @@ jobs: with: path: 'master-branch' - - name: test - working-directory: master-branch - run: | - echo ${{ github.event.client_payload.version }} + # - name: test + # working-directory: master-branch + # run: | + # echo ${{ github.event.client_payload.version }} From 6c390f4006caa014e304993c7bac192d8a15b182 Mon Sep 17 00:00:00 2001 From: PavelSinelnik Date: Tue, 25 Jun 2024 16:32:53 +0300 Subject: [PATCH 06/10] remove comments --- .github/workflows/automatic-2.yml | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/.github/workflows/automatic-2.yml b/.github/workflows/automatic-2.yml index 1a46413..587c487 100644 --- a/.github/workflows/automatic-2.yml +++ b/.github/workflows/automatic-2.yml @@ -1,10 +1,8 @@ name: automatic-2 on: - pull_request: - branches: [master] -# repository_dispatch: -# types: [manual-Version] + repository_dispatch: + types: [manual-Version] jobs: build-and-push: @@ -15,7 +13,7 @@ jobs: with: path: 'master-branch' - # - name: test - # working-directory: master-branch - # run: | - # echo ${{ github.event.client_payload.version }} + - name: test + working-directory: master-branch + run: | + echo ${{ github.event.client_payload.version }} From 3167fe0d7a085bc92a4fb59ea9a1afc3d1a2bd02 Mon Sep 17 00:00:00 2001 From: PavelSinelnik Date: Tue, 25 Jun 2024 17:23:21 +0300 Subject: [PATCH 07/10] add if condition --- .github/workflows/automatic-2.yml | 7 +++---- .github/workflows/manual-1.yml | 1 - 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/.github/workflows/automatic-2.yml b/.github/workflows/automatic-2.yml index 587c487..3acee0f 100644 --- a/.github/workflows/automatic-2.yml +++ b/.github/workflows/automatic-2.yml @@ -1,19 +1,18 @@ name: automatic-2 on: + repository_dispatch: types: [manual-Version] jobs: build-and-push: + if: ${{ github.event.client_payload.passed }} runs-on: ubuntu-20.04 steps: - name: Checkout Specifications uses: actions/checkout@v2 - with: - path: 'master-branch' - name: test - working-directory: master-branch run: | - echo ${{ github.event.client_payload.version }} + echo github.event.client_payload.version = ${{ github.event.client_payload.version }} diff --git a/.github/workflows/manual-1.yml b/.github/workflows/manual-1.yml index 5aebe91..29e68b2 100644 --- a/.github/workflows/manual-1.yml +++ b/.github/workflows/manual-1.yml @@ -14,7 +14,6 @@ on: default: "" jobs: - release-clients: runs-on: ubuntu-latest steps: From 6e646e3b238531a9001c20ef35f41897d8c7f2f7 Mon Sep 17 00:00:00 2001 From: PavelSinelnik Date: Thu, 4 Jul 2024 11:49:40 +0300 Subject: [PATCH 08/10] add repo dispatch event, adding pushing tag to repo after success event --- .github/workflows/automatic-2.yml | 18 ----------------- .github/workflows/manual-1.yml | 28 -------------------------- .github/workflows/release-clients.yml | 8 ++++++++ .github/workflows/release-web-page.yml | 24 ++++++++++++++++++---- 4 files changed, 28 insertions(+), 50 deletions(-) delete mode 100644 .github/workflows/automatic-2.yml delete mode 100644 .github/workflows/manual-1.yml diff --git a/.github/workflows/automatic-2.yml b/.github/workflows/automatic-2.yml deleted file mode 100644 index 3acee0f..0000000 --- a/.github/workflows/automatic-2.yml +++ /dev/null @@ -1,18 +0,0 @@ -name: automatic-2 - -on: - - repository_dispatch: - types: [manual-Version] - -jobs: - build-and-push: - if: ${{ github.event.client_payload.passed }} - runs-on: ubuntu-20.04 - steps: - - name: Checkout Specifications - uses: actions/checkout@v2 - - - name: test - run: | - echo github.event.client_payload.version = ${{ github.event.client_payload.version }} diff --git a/.github/workflows/manual-1.yml b/.github/workflows/manual-1.yml deleted file mode 100644 index 29e68b2..0000000 --- a/.github/workflows/manual-1.yml +++ /dev/null @@ -1,28 +0,0 @@ -name: manual-1 - -on: - pull_request: - branches: [master] - workflow_dispatch: - inputs: - version: - description: "Version" - required: true - options: - description: "Possible options: --prerelease" - required: false - default: "" - -jobs: - release-clients: - runs-on: ubuntu-latest - steps: - - name: Manual 1 - run: | - echo ${{github.event.inputs.version}} - - - name: Repository Dispatch - uses: peter-evans/repository-dispatch@v3 - with: - event-type: manual-Version - client-payload: '{"version": "${{github.event.inputs.version}}"}' diff --git a/.github/workflows/release-clients.yml b/.github/workflows/release-clients.yml index c3447a2..0650f0f 100644 --- a/.github/workflows/release-clients.yml +++ b/.github/workflows/release-clients.yml @@ -24,3 +24,11 @@ jobs: gh release create v${{github.event.inputs.version}} ${{github.event.inputs.options}} --title ${{github.event.inputs.version}} --repo regulaforensics/DocumentReader-web-csharp-client env: GITHUB_TOKEN: ${{ secrets.REGULA_GITHUB_PUSH_TOKEN }} + + - name: Repository Dispatch + uses: peter-evans/repository-dispatch@v3 + with: + event-type: release-web-page + client-payload: '{"version": "${{github.event.inputs.version}}", "success": true}' + if: ${{ success() }} + \ No newline at end of file diff --git a/.github/workflows/release-web-page.yml b/.github/workflows/release-web-page.yml index 97b9330..0d88676 100644 --- a/.github/workflows/release-web-page.yml +++ b/.github/workflows/release-web-page.yml @@ -1,18 +1,28 @@ name: release web page on: - push: - branches: - - master + repository_dispatch: + types: [release-web-page] + jobs: build-and-push: + if: ${{ github.event.client_payload.success }} runs-on: ubuntu-20.04 steps: - name: Checkout Specifications uses: actions/checkout@v2 with: path: 'master-branch' + + - name: Install yq + uses: vegardit/gha-setup-yq@v1 + with: + version: 4.44.2 + + - name: Replace index.yml version + run: yq -i ".info.version =\"${{ github.event.client_payload.version }}\"" index.yml + - name: Install redoc-cli uses: actions/setup-node@v1 with: @@ -46,4 +56,10 @@ jobs: git commit -m "update pages" git push origin gh-pages env: - GITHUB_TOKEN: ${{ secrets.REGULA_GITHUB_PUSH_TOKEN }} \ No newline at end of file + GITHUB_TOKEN: ${{ secrets.REGULA_GITHUB_PUSH_TOKEN }} + + - name: Pushing tag to Repo + uses: thejeff77/action-push-tag@v1.0.0 + with: + tag: v${{ github.event.client_payload.version }} + if: ${{ success() }} From 513fd45bbe3857a1013cfc60b69d8d716606957d Mon Sep 17 00:00:00 2001 From: PavelSinelnik Date: Thu, 4 Jul 2024 11:50:57 +0300 Subject: [PATCH 09/10] remove spaces --- .github/workflows/release-clients.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/release-clients.yml b/.github/workflows/release-clients.yml index 0650f0f..bf098d3 100644 --- a/.github/workflows/release-clients.yml +++ b/.github/workflows/release-clients.yml @@ -31,4 +31,3 @@ jobs: event-type: release-web-page client-payload: '{"version": "${{github.event.inputs.version}}", "success": true}' if: ${{ success() }} - \ No newline at end of file From f814fcc6c3b7343000b24f8b9d684886d3e60a21 Mon Sep 17 00:00:00 2001 From: PavelSinelnik Date: Thu, 4 Jul 2024 11:57:19 +0300 Subject: [PATCH 10/10] return triggers to another actions --- .github/workflows/validate-spec.yml | 2 +- .github/workflows/verify-clients.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/validate-spec.yml b/.github/workflows/validate-spec.yml index fd317c8..2e430b1 100644 --- a/.github/workflows/validate-spec.yml +++ b/.github/workflows/validate-spec.yml @@ -1,7 +1,7 @@ name: validate specification on: - push: + pull_request: branches: - master diff --git a/.github/workflows/verify-clients.yml b/.github/workflows/verify-clients.yml index c924a58..b624143 100644 --- a/.github/workflows/verify-clients.yml +++ b/.github/workflows/verify-clients.yml @@ -1,7 +1,7 @@ name: verify clients on: - push: + pull_request: branches: - master