Scripts: add monthly_data_maintenance.yml for NSI logos

This commit is contained in:
Pieter Vander Vennet 2025-04-26 23:26:12 +02:00
parent f1ca0c6822
commit ecf0a4f749
2 changed files with 30 additions and 17 deletions

View file

@ -0,0 +1,23 @@
name: 'Upload_hetzner'
description: 'Uploads a directory to hetzner. Will zip first, for performance'
inputs:
src:
description: 'The source directory'
required: true
dst:
description: "The destination directory. The source directory will be placed _inside_"
required: true
runs:
using: 'composite'
steps:
- name: Upload
shell: bash
run: |
F=$(head /dev/urandom | tr -dc A-Za-z0-9 | head -c 16)
zip $F.zip ${{ inputs.src }}/*
scp $F.zip hetzner:${{ inputs.dst }}/
ssh hetzner "cd ${{ inputs.dst }} unzip $F.zip && rm $F.zip"

View file

@ -4,28 +4,18 @@ on:
- cron: "0 2 1 * *"
jobs:
monthly_data_maintenance:
update_nsi_logos:
runs-on: [ ubuntu-latest, hetzner-access ]
steps:
- uses: https://source.mapcomplete.org/actions/checkout@v4
- uses: ./.forgejo/setup
- name: create community index files
- name: Download the NSI-logos
shell: bash
run: npm run download:community-index -- -- community-index/
run: npm run download:nsi-logos
- name: upload community index
shell: bash
run: |
zip community-index.zip community-index/*
scp community-index.zip hetzner:data/
ssh hetzner "cd data && rm -rf community-index/ && unzip community-index.zip && rm community-index.zip"
- uses: ./.forgejo/upload_hetzner
with:
src: "./public/assets/data/nsi"
dst: "nsi"
- name: Update statistics
shell: bash
run: |
scp -r hetzner:~/data/changeset-metadata/ .
npm run download:stats -- -- ./
scp -r ./changeset-metadata/* hetzner:~/data/changeset-metadata/