add berkeley ocf mirror #13
This file contains hidden or 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: Mirrors | |
| on: | |
| push: | |
| branches: | |
| - master | |
| paths: | |
| - 'mirrors/**' | |
| - 'wiki/mirrors_header.md' | |
| pull_request: | |
| paths: | |
| - 'mirrors/**' | |
| jobs: | |
| lint-mirror-files: | |
| runs-on: ubuntu-slim | |
| steps: | |
| - name: Check out repository | |
| uses: actions/checkout@v6 | |
| - name: Check mirror files | |
| run: | | |
| for file in mirrors/default $(git ls-files mirrors/*/*); do | |
| if head -n 4 "$file" | grep -qv '^#'; then | |
| echo "Error: $file does not have 4 header lines starting with #" > /dev/stderr | |
| exit 1 | |
| fi | |
| if ! grep -q '^MAIN=' "$file"; then | |
| echo "Error: $file does not contain MAIN" > /dev/stderr | |
| exit 1 | |
| fi | |
| if ! grep -q '^ROOT=' "$file"; then | |
| echo "Error: $file does not contain ROOT" > /dev/stderr | |
| exit 1 | |
| fi | |
| if ! grep -q '^X11=' "$file"; then | |
| echo "Error: $file does not contain X11" > /dev/stderr | |
| exit 1 | |
| fi | |
| if ! grep -q "$(basename $file)" mirrors/Makefile.am; then | |
| echo "Error: $file is not listed in mirrors/Makefile.am" | |
| fi | |
| echo "$file passed validation." | |
| done | |
| update-wiki-mirror: | |
| runs-on: ubuntu-slim | |
| needs: lint-mirror-files | |
| if: github.event_name == 'push' && github.ref == 'refs/heads/master' | |
| steps: | |
| - name: Check out repository | |
| uses: actions/checkout@v6 | |
| - name: Set up SSH key | |
| env: | |
| GITHUB_SSH_KEY: ${{ secrets.TERMUXBOT2_SSH_KEY }} | |
| run: | | |
| mkdir -p ~/.ssh | |
| echo "$GITHUB_SSH_KEY" > ~/.ssh/id_ed25519_termuxbot2 | |
| chmod 600 ~/.ssh/id_ed25519_termuxbot2 | |
| ssh-keyscan github.com >> ~/.ssh/known_hosts | |
| - name: Clone termux-packages.wiki | |
| run: | | |
| if [ ! -d termux-packages.wiki ]; then | |
| GIT_SSH_COMMAND="ssh -i ~/.ssh/id_ed25519_termuxbot2" git clone git@github.com:termux/termux-packages.wiki.git | |
| cd termux-packages.wiki | |
| else | |
| cd termux-packages.wiki | |
| git pull origin master | |
| fi | |
| git config --global user.name "Termux Github Actions" | |
| git config --global user.email "contact@termux.dev" | |
| - name: Generate the Wiki page | |
| run: | | |
| cd termux-packages.wiki | |
| bash ../mirrors/generate-wiki-page.sh | |
| - name: Commit and push changes | |
| run: | | |
| cd termux-packages.wiki | |
| git add Mirrors.md | |
| # Check if there are any changes before commiting and pushing | |
| if ! git diff --cached --exit-code > /dev/null; then | |
| git commit -m "Update Mirrors.md after termux-tools commit ${GITHUB_SHA::12}" \ | |
| -m "See https://github.com/termux/termux-tools/tree/${GITHUB_SHA}." | |
| GIT_SSH_COMMAND="ssh -i ~/.ssh/id_ed25519_termuxbot2" git push origin master | |
| fi |