From 2e4755f24764ed6a57ed6aa4e619ba20cfe29371 Mon Sep 17 00:00:00 2001 From: h7x4 Date: Tue, 7 Apr 2026 16:52:31 +0900 Subject: [PATCH] .gitea/workflows: add job to automatically update datasources --- .gitea/workflows/update-data-sources.yml | 67 ++++++++++++++++++++++++ 1 file changed, 67 insertions(+) create mode 100644 .gitea/workflows/update-data-sources.yml diff --git a/.gitea/workflows/update-data-sources.yml b/.gitea/workflows/update-data-sources.yml new file mode 100644 index 0000000..ebc884b --- /dev/null +++ b/.gitea/workflows/update-data-sources.yml @@ -0,0 +1,67 @@ +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 + + 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 + + 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 + + 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