diff --git a/.github/scripts/gen_blocklisten.md.sh b/.github/scripts/gen_blocklisten.md.sh index 1f5589e5f..5106d171b 100755 --- a/.github/scripts/gen_blocklisten.md.sh +++ b/.github/scripts/gen_blocklisten.md.sh @@ -1,4 +1,5 @@ #!/bin/bash +set -e # Beende das Skript bei einem Fehler # Voreinstellungen SUCHVERZEICHNIS=Blocklisten @@ -10,7 +11,9 @@ TEMPLATE_S2=./Template/$PATCHTHEFILE/02 LINKS=/tmp/$SUCHVERZEICHNIS.txt # Hole die Links -rm $LINKS +if [ -e "$LINKS" ]; then + rm "$LINKS" +fi find ./$SUCHVERZEICHNIS/* -name '*' -type f \ | grep -v ".md" \ diff --git a/.github/scripts/gen_dnsmasq_readme.md.sh b/.github/scripts/gen_dnsmasq_readme.md.sh index b79ed58f3..932244a30 100755 --- a/.github/scripts/gen_dnsmasq_readme.md.sh +++ b/.github/scripts/gen_dnsmasq_readme.md.sh @@ -1,4 +1,5 @@ #!/bin/bash +set -e # Beende das Skript bei einem Fehler # Voreinstellungen SUCHVERZEICHNIS=DNSMASQ @@ -10,7 +11,9 @@ TEMPLATE_S2=./Template/$SUCHVERZEICHNIS/$PATCHTHEFILE/02 LINKS=/tmp/$SUCHVERZEICHNIS.txt # Hole die Links -rm $LINKS +if [ -e "$LINKS" ]; then + rm "$LINKS" +fi find ./$SUCHVERZEICHNIS/* -name '*' -type f \ | grep -v ".md" \ diff --git a/.github/workflows/gen_blocklisten.md.yml b/.github/workflows/gen_blocklisten.md.yml deleted file mode 100644 index b43b5770c..000000000 --- a/.github/workflows/gen_blocklisten.md.yml +++ /dev/null @@ -1,71 +0,0 @@ -name: gen_blocklisten.md - -on: - push: - branches: [ master ] - paths: - - '.github/workflows/gen_blocklisten.md.yml' - - '.github/scripts/gen_blocklisten.md.sh' - - 'Template/Blocklisten.md/*' - schedule: - - cron: '20 12 * * *' - workflow_dispatch: - -env: - SCRIPT: .github/scripts/gen_blocklisten.md.sh - -jobs: - build: - container: - image: ubuntu:22.04 - - runs-on: ubuntu-latest - if: github.repository == 'RPiList/specials' - - steps: - - - name: key - id: key - run: | - export KEY="${GITHUB_WORKFLOW%-*}" - echo "key=$KEY" >> $GITHUB_OUTPUT - echo "################################################################" && bash -c "echo KEY=$KEY" - - - name: update - run: apt-get -y update && apt-get -y upgrade && apt-get -y dist-upgrade - - - name: install - run: | - DEBIAN_FRONTEND=noninteractive apt-get -y install \ - git locales - - - name: locale - run: locale-gen en_US.utf8 && locale-gen de_DE.UTF-8 && update-locale - - - name: clone - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - run: | - git config --global --add safe.directory $GITHUB_WORKSPACE - git clone https://github-actions:$GITHUB_TOKEN@${GITHUB_SERVER_URL##*/}/$GITHUB_REPOSITORY.git $GITHUB_WORKSPACE --branch $GITHUB_REF_NAME - - - name: generate - run: | - export LANG=en_US.utf8 - [ "${{ github.workflow }}" != "${{ steps.key.outputs.key }}" ] && c=5 || c=1 - seq $c | while read x; do chmod +x ${{ env.SCRIPT }} && ./${{ env.SCRIPT }}; done - - - name: commit - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - run: | - git config --global --add safe.directory $GITHUB_WORKSPACE - git pull - git add . - git status - git config --local user.name github-actions - git config --local user.email github-actions@github.com - git diff --cached --quiet && exit 0 || git commit -m "Auto-Update" - git config --local credential.helper '!x() { echo "password=$GITHUB_TOKEN"; };x' - git push origin $GITHUB_REF_NAME - diff --git a/.github/workflows/gen_dnsmasq_readme.md.yml b/.github/workflows/gen_md_files.yml similarity index 77% rename from .github/workflows/gen_dnsmasq_readme.md.yml rename to .github/workflows/gen_md_files.yml index 14fcf1f22..387253125 100644 --- a/.github/workflows/gen_dnsmasq_readme.md.yml +++ b/.github/workflows/gen_md_files.yml @@ -1,29 +1,33 @@ -name: gen_dnsmasq_readme.md +name: generate selected *.md files on: push: branches: [ master ] paths: - - '.github/workflows/gen_dnsmasq_readme.md.yml' + - '.github/workflows/gen_md_files.yml' + + - '.github/scripts/gen_blocklisten.md.sh' + - 'Template/Blocklisten.md/*' + - '.github/scripts/gen_dnsmasq_readme.md.sh' - 'Template/DNSMASQ/readme.md/*' + schedule: - cron: '20 12 * * *' workflow_dispatch: env: - SCRIPT: .github/scripts/gen_dnsmasq_readme.md.sh + SCRIPT01: .github/scripts/gen_blocklisten.md.sh + SCRIPT02: .github/scripts/gen_dnsmasq_readme.md.sh jobs: - build: + generate-and-deploy: container: image: ubuntu:22.04 - runs-on: ubuntu-latest if: github.repository == 'RPiList/specials' steps: - - name: key id: key run: | @@ -53,7 +57,9 @@ jobs: run: | export LANG=en_US.utf8 [ "${{ github.workflow }}" != "${{ steps.key.outputs.key }}" ] && c=5 || c=1 - seq $c | while read x; do chmod +x ${{ env.SCRIPT }} && ./${{ env.SCRIPT }}; done + + seq $c | while read x; do echo run ${{ env.SCRIPT01 }} && chmod +x ${{ env.SCRIPT01 }} && ./${{ env.SCRIPT01 }}; done + seq $c | while read x; do echo run ${{ env.SCRIPT02 }} && chmod +x ${{ env.SCRIPT02 }} && ./${{ env.SCRIPT02 }}; done - name: commit env: