Skip to content
67 changes: 67 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
name: CI

#on:
# pull_request

on:
repository_dispatch:
#types: open
types: [dispatch-katacoda-scenarios]

workflow_dispatch:
jobs:
build:
runs-on: ubuntu-latest
timeout-minutes: 10

steps:
- name: choose random polling time
id: randompoll
uses: ddradar/[email protected]
with:
contents: |
1
3
5
9
13

- name: Wait for parallel workflows to finish
uses: softprops/[email protected]
with:
poll-interval-seconds: ${{ steps.randompoll.outputs.selected }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Checkout tutorial-compiler
uses: actions/checkout@v2
with:
repository: devonfw-tutorials/tutorial-compiler

- name: Checkout playbooks
uses: actions/checkout@v2
with:
repository: devonfw-tutorials/tutorials
path: playbooks

- uses: actions/setup-node@v2-beta

- name: install TS
run: npm install typescript

- name: npm install
run: npm install

- name: run buildRun.sh
run: |
pwd
ls
sh buildRun.sh -e wiki_eclipse -e wiki_vscode -p ${{ github.event.client_payload.tutorial }}

- name: Checkout
uses: actions/checkout@v2
with:
path: repo

- name: publish tutorials
run: bash repo/publishTutorials.sh
37 changes: 37 additions & 0 deletions .github/workflows/nightBuild.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
name: CI

on:
schedule:
# - cron: "*/5 * * * *"
- cron: "0 0 * * *"

workflow_dispatch:
jobs:
nightly_build:
runs-on: ubuntu-latest

steps:
- name: Checkout tutorial-compiler
uses: actions/checkout@v2
with:
repository: devonfw-tutorials/tutorial-compiler

- name: Checkout playbooks
uses: actions/checkout@v2
with:
repository: devonfw-tutorials/tutorials
path: playbooks

- uses: actions/setup-node@v2-beta

- name: install TS
run: npm install typescript

- name: npm install
run: npm install

- name: run buildRun.sh
run: |
pwd
ls
sh buildRun.sh
51 changes: 51 additions & 0 deletions publishTutorials.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
#!/bin/bash
# start after the folder playbooks is created in the current repository
cd playbooks
SPECIFIED_TUTORIALS=()
for dir in */; do SPECIFIED_TUTORIALS+=("${dir::-1}"); done
echo "SPECIFIED_TUTORIALS:\n"
printf "%s\n" "${SPECIFIED_TUTORIALS[@]}"
# switches to tutorials repository https://github.com/devonfw-tutorials/tutorials
cd ../repo/tutorials
ONLINE_TUTORIALS=()
for dir in */; do ONLINE_TUTORIALS+=("${dir::-1}"); done
echo "ONLINE_TUTORIALS:\n"
printf "%s\n" "${ONLINE_TUTORIALS[@]}"

# delete tutorials, which are not specified anymore
for tutorial in "${ONLINE_TUTORIALS[@]}"
do
if [[ ! " ${SPECIFIED_TUTORIALS[@]} " =~ " ${tutorial} " ]]; then
rm -rf "${tutorial}"
echo "deleted ${tutorial} as not specified anymore in tutorials repository"
fi
done

# switches to tutorials compiler repository https://github.com/devonfw-tutorials/tutorial-compiler (build/output/wiki)
cd ../build/output/wiki
GENERATED_TUTORIALS=()
for dir in */; do GENERATED_TUTORIALS+=("${dir::-1}"); done
echo "GENERATED_TUTORIALS:\n"
printf "%s\n" "${GENERATED_TUTORIALS[@]}"
# back to tutorials compiler repository
cd ../../..

# delete tutorials, which are newly generated
for tutorial in "${ONLINE_TUTORIALS[@]}"
do
if [[ ! " ${GENERATED_TUTORIALS[@]} " =~ " ${tutorial} " ]]; then
rm -rf repo/"${tutorial}"
echo "deleted ${tutorial} as this is up to be replaced by the build"
fi
done

mkdir -p tutorials
#copy all files from * in repo/tutorials (https://github.com/devonfw-tutorials/wiki-tutorials/tutorials)
cp -r build/output/wiki/*/ repo/tutorials
cd repo/
git add -A
git config user.email "devonfw"
git config user.name "devonfw"
git commit -m "Updated tutorials"
git pull --rebase origin/master
git push