-
Notifications
You must be signed in to change notification settings - Fork 240
75 lines (62 loc) · 2.55 KB
/
gen_md_files.yml
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
name: generate selected *.md files
on:
push:
branches: [ master ]
paths:
- '.github/workflows/gen_md_files.yml'
- '.github/scripts/gen_*.sh'
- '.github/markdown_templates/*'
schedule:
- cron: '20 12 * * *'
workflow_dispatch:
env:
SCRIPT01: .github/scripts/gen_blocklisten.md.sh
SCRIPT02: .github/scripts/gen_dnsmasq_readme.md.sh
SCRIPT03: .github/scripts/gen_mikrotik_readme.md.sh
jobs:
generate-and-deploy:
container:
image: ubuntu:24.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 --single-branch
- name: generate
run: |
export LANG=en_US.utf8
[ "${{ github.workflow }}" != "${{ steps.key.outputs.key }}" ] && c=5 || c=1
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
seq $c | while read x; do echo run ${{ env.SCRIPT03 }} && chmod +x ${{ env.SCRIPT03 }} && ./${{ env.SCRIPT03 }}; 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