.gitea/workflows: add job to automatically update datasources

This commit is contained in:
2026-04-07 16:52:31 +09:00
parent bd617a2875
commit 9379cb7012

View File

@@ -0,0 +1,70 @@
name: "Update data sources"
on:
workflow_dispatch:
schedule:
- cron: '0 12 * * 2'
jobs:
update-sources:
runs-on: debian-latest
steps:
- name: Install deps
run: apt-get install --update --assume-yes sudo git
- name: Install nix
uses: https://github.com/cachix/install-nix-action@v31
with:
extra_nix_config: |
experimental-features = nix-command flakes
- name: Git config
run: |
git config --global user.name 'Gitea Clanker'
git config --global user.email 'gitea@pvv.ntnu.no'
- name: Checkout repository
uses: actions/checkout@v2
- name: Update jmdict
run: nix run .#update-jmdict
- name: Commit and push changes
run: |
if ! git diff --quiet; then
OLD_VERSION=$(git show HEAD:./jmdict/version.txt)
NEW_VERSION=$(cat ./jmdict/version.txt)
git add jmdict
git commit -m "JMdict: $OLD_VERSION -> $NEW_VERSION"
git push
else
echo "No changes to commit"
fi
- name: Update kanjidic2
run: nix run .#update-kanjidic2
- name: Commit and push changes
run: |
if ! git diff --quiet; then
OLD_VERSION=$(git show HEAD:./kanjidic2/version.txt)
NEW_VERSION=$(cat ./kanjidic2/version.txt)
git add kanjidic2
git commit -m "KANJIDIC2: $OLD_VERSION -> $NEW_VERSION"
git push
else
echo "No changes to commit"
fi
- name: Update radkfile
run: nix run .#update-radkfile
- name: Commit and push changes
run: |
if ! git diff --quiet; then
OLD_VERSION=$(git show HEAD:./radkfile/version.txt)
NEW_VERSION=$(cat ./radkfile/version.txt)
git add radkfile
git commit -m "RADKFILE: $OLD_VERSION -> $NEW_VERSION"
git push
else
echo "No changes to commit"
fi