Import changes from ebusd-configuration repository. #20
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Import changes from ebusd-configuration repository. | |
on: | |
workflow_dispatch: | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
with: | |
persist-credentials: false | |
fetch-depth: 1 | |
submodules: true | |
- name: Use Node.js node 20.x | |
uses: actions/setup-node@v4 | |
with: | |
node-version: 20.x | |
- name: Install packages | |
run: npm install -omit=dev | |
working-directory: ebusd-configuration/ | |
- name: Convert typespec files (en) | |
run: npm run compile | |
working-directory: ebusd-configuration/ | |
- name: Convert typespec files (de) | |
run: npm run compile-de | |
working-directory: ebusd-configuration/ | |
- name: Stash versions | |
continue-on-error: true | |
run: | | |
mv de/versions.json de-versions.json | |
mv en/versions.json en-versions.json | |
- name: Move files and generate index | |
run: | | |
rm -rf de en | |
mkdir de en | |
mv ebusd-configuration/outcsv/@ebusd/ebus-typespec/* en/ | |
mv ebusd-configuration/outcsv.de/@ebusd/ebus-typespec/* de/ | |
find ebusd-configuration/src -type l -exec ./.github/workflows/copylink.sh ebusd-configuration/src \{\} de en \; | |
find en/ -type d -exec ./.github/workflows/genindex.sh \{\} \; | |
find de/ -type d -exec ./.github/workflows/genindex.sh \{\} \; | |
- name: Generate mapping | |
run: | | |
date=$(date +%Y-%m-%d) | |
ref=$(cd ebusd-configuration && git rev-parse HEAD) | |
shortref=$(cd ebusd-configuration && git rev-parse --short HEAD) | |
branch=$(egrep "submodule |branch =" .gitmodules |egrep -A1 'submodule "ebusd-configuration"'|egrep branch|head -n 1|sed -e 's#.*= *##') | |
cat mapping.md.tmpl | sed -e "s#\$date#$date#g" -e "s#\$ref#$ref#g" -e "s#\$shortref#$shortref#g" -e "s#\$branch#$branch#g" > mapping.md | |
((cd ebusd-configuration/src/ && find . -type d) | xargs -L1 ./.github/workflows/genmapping.sh mapping.md ebusd-configuration/src $branch) | |
- name: Unstash versions | |
continue-on-error: true | |
run: | | |
mv de-versions.json de/versions.json | |
mv en-versions.json en/versions.json | |
- name: Update versions | |
run: | | |
./.github/workflows/genversions.sh en | |
./.github/workflows/genversions.sh de | |
- name: Upload artifacts | |
uses: actions/upload-artifact@v4 | |
with: | |
name: conversion_result | |
path: | | |
mapping.md | |
en | |
de | |
- name: Commit files | |
run: | | |
git config --local user.email "github-actions[bot]@users.noreply.github.com" | |
git config --local user.name "github-actions[bot]" | |
git add de en mapping.md | |
git commit -a -m "import changes from ebusd-configuration" | |
- name: Push changes | |
uses: ad-m/github-push-action@master | |
with: | |
github_token: ${{ secrets.GITHUB_TOKEN }} | |
branch: ${{ github.ref }} |