From 0ea826137dd008edf775a86703a0f17b0e3394c8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lukas=20R=C3=B6mer?= Date: Fri, 9 Jun 2023 17:28:52 +0200 Subject: [PATCH] Add workflow to auto-generate model artifacts upon merging PR --- .github/workflows/generate-artifacts.yml | 53 ++++++++++++++++++++++++ generate.sh | 2 +- 2 files changed, 54 insertions(+), 1 deletion(-) create mode 100644 .github/workflows/generate-artifacts.yml diff --git a/.github/workflows/generate-artifacts.yml b/.github/workflows/generate-artifacts.yml new file mode 100644 index 00000000..331c6299 --- /dev/null +++ b/.github/workflows/generate-artifacts.yml @@ -0,0 +1,53 @@ +####################################################################### +# Copyright (c) 2023 Robert Bosch Manufacturing Solutions GmbH +# +# See the NOTICE file(s) distributed with this work for additional +# information regarding copyright ownership. +# +# This work is made available under the terms of the +# Creative Commons Attribution 4.0 International (CC-BY-4.0) license, +# which is available at +# https://creativecommons.org/licenses/by/4.0/legalcode. +# +# SPDX-License-Identifier: CC-BY-4.0 +####################################################################### + +name: Generate Model Artifacts + +on: + push: + branches: + - main + +jobs: + generate-model-artifacts: + name: 02 Generate model artifacts + runs-on: ubuntu-latest + permissions: + contents: write + steps: + - name: Checkout + uses: actions/checkout@v3 + - name: Check Changes + id: changes + uses: Ana06/get-changed-files@v2.2.0 + with: + format: csv + filter: "*.ttl" + - uses: actions/setup-java@v3 + with: + distribution: temurin + java-version: '17' + - name: Generate artifacts for new models + run: | + mapfile -d ',' -t added_modified_files < <(printf '%s,' '${{ steps.changes.outputs.added_modified }}') + for added_modified_file in "${added_modified_files[@]}"; do + echo "Generate model artifacts for ${added_modified_file}." + ./generate.sh ${added_modified_file} + done + - name: Commit new artifacts + run: | + git config --global user.name "GitHub Actions Bot" + git config --global user.email "username@users.noreply.github.com" + git commit -a -m "Adding auto-generated artifacts for new models" + git push diff --git a/generate.sh b/generate.sh index 527e9204..9de0b1a8 100755 --- a/generate.sh +++ b/generate.sh @@ -1,4 +1,4 @@ -#! /bin/sh +#!/bin/bash ####################################################################### # Copyright (c) 2023 Robert Bosch Manufacturing Solutions GmbH # Copyright (c) 2023 Contributors to the Eclipse Foundation