Skip to content

Commit 58de341

Browse files
fix (schema): update create-schema to handle update-schema as well
1 parent 6921b4f commit 58de341

File tree

1 file changed

+13
-22
lines changed

1 file changed

+13
-22
lines changed

.github/workflows/create-schema.yml

Lines changed: 13 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,42 +1,34 @@
11
name: Create Schema for latest release
22

33
on:
4-
repository_dispatch:
5-
types: [create_schema]
6-
workflow_dispatch:
4+
release:
5+
types: [published]
76

87
jobs:
8+
determine_whether_to_run:
9+
runs-on: ubuntu-latest
10+
outputs:
11+
update_schema: ${{ steps.check-update-schema.outputs.run_jobs }}
12+
13+
steps:
14+
- name: Check if event should be sent
15+
id: check-update-schema
16+
run: (echo "${{ github.ref }}" | grep -Eq '^refs\/tags\/[0-9]+\.[0-9]+\.[0-9]+$') && echo "::set-output name=run_jobs::true" || echo "::set-output name=run_jobs::false"
917
create_schema:
1018
runs-on: ubuntu-latest
19+
needs: determine_whether_to_run
20+
if: needs.determine_whether_to_run.outputs.update_schema == 'true'
1121
name: Create Schema
1222

1323
steps:
1424
- name: Checkout noss Repo
1525
uses: actions/checkout@v3
16-
with:
17-
path: noss
18-
19-
- name: Checkout oss repo
20-
uses: actions/checkout@v3
21-
with:
22-
repository: appbaseio/reactivesearch-api
23-
path: oss
24-
token: ${{ secrets.REPO_ACCESS_TOKEN }}
2526

2627
- name: Make clean and build
2728
run: make clean && make
28-
working-directory: ./noss
2929

3030
- name: Generate the latest schema
3131
run: ./build/reactivesearch --create-schema
32-
working-directory: ./noss
33-
34-
- name: Remove older schema
35-
run: rm schema -rf
36-
working-directory: ./oss
37-
38-
- name: Copy the built schema to oss
39-
run: cp -r noss/schema oss/
4032

4133
- name: Add and Commit changes
4234
uses: EndBug/add-and-commit@v9
@@ -45,4 +37,3 @@ jobs:
4537
default_author: github_actions
4638
message: Update schema for latest release
4739
push: true
48-
cwd: ./oss

0 commit comments

Comments
 (0)