-
Notifications
You must be signed in to change notification settings - Fork 0
79 lines (79 loc) · 3 KB
/
generate.yml
File metadata and controls
79 lines (79 loc) · 3 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
name: 'Generate Java Classes'
on:
workflow_dispatch:
inputs:
tag:
type: string
default: latest
required: false
workflow_call:
inputs:
tag:
type: string
required: true
secrets:
BO4E_JAVA_GENERATOR_TOKEN:
required: true
jobs:
generation:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4.1.1
- name: Setup node
uses: actions/setup-node@v4.0.2
with:
node-version: 20.15.x
cache: npm
- name: Install
run: npm install
- name: Get Schemas
id: schemas
env:
TAG: ${{ inputs.tag }}
run: |
RELEASETAG=`node download_repo.js -T -o "bo4e" -r "BO4E-Schemas" -t "$TAG"`
echo $RELEASETAG
echo "TAGNAME=$RELEASETAG" >> "$GITHUB_OUTPUT"
- name: Generate
if: ${{ steps.schemas.outputs.TAGNAME != 'invalid' }}
run: |
[[ -d "BO4E-Schemas/src/bo4e_schemas" ]] && node quicktype.js -c -i "BO4E-Schemas/src/bo4e_schemas" -o "bo4e"
- name: Push changes
if: ${{ steps.schemas.outputs.TAGNAME != 'invalid' }}
uses: cpina/github-action-push-to-another-repository@v1.7.2
env:
API_TOKEN_GITHUB: ${{ secrets.BO4E_JAVA_GENERATOR_TOKEN }}
with:
source-directory: "bo4e"
target-directory: "bo4e"
destination-github-username: "bo4e"
destination-repository-name: "BO4E-Java"
user-email: bo4e-schemas@hochfrequenz.de
target-branch: main
commit-message: "Update JAVA-Classes - BO4E ${{ steps.schemas.outputs.TAGNAME }}"
- name: Generate with dependecies
if: ${{ steps.schemas.outputs.TAGNAME != 'invalid' }}
run: |
[[ -d "BO4E-Schemas/src/bo4e_schemas" ]] && node quicktype.js -ca -i "BO4E-Schemas/src/bo4e_schemas" -o "bo4e"
- name: Push changes with dependencies
if: ${{ steps.schemas.outputs.TAGNAME != 'invalid' }}
uses: cpina/github-action-push-to-another-repository@v1.7.2
env:
API_TOKEN_GITHUB: ${{ secrets.BO4E_JAVA_GENERATOR_TOKEN }}
with:
source-directory: "bo4e"
target-directory: "bo4e"
destination-github-username: "bo4e"
destination-repository-name: "BO4E-Java"
user-email: bo4e-schemas@hochfrequenz.de
target-branch: withDependencies
commit-message: "Update JAVA-Classes - BO4E ${{ steps.schemas.outputs.TAGNAME }}-wd"
- name: Create Release
if: ${{ steps.schemas.outputs.TAGNAME != 'invalid' }}
env:
TOKEN: ${{ secrets.BO4E_JAVA_GENERATOR_TOKEN }}
VERSION: ${{ steps.schemas.outputs.TAGNAME }}
run: |
node create_release.js -o "bo4e" -r "BO4E-Java" -a "$TOKEN" -t "$VERSION" --input-owner "bo4e" --input-repo "BO4E-Schemas"
node create_release.js -o "bo4e" -r "BO4E-Java" -a "$TOKEN" -t "$VERSION" -b "withDependencies" --input-owner "bo4e" --input-repo "BO4E-Schemas"