diff --git a/.forgejo/upload_hetzner/action.yml b/.forgejo/upload_hetzner/action.yml new file mode 100644 index 0000000000..5ccdc43fd3 --- /dev/null +++ b/.forgejo/upload_hetzner/action.yml @@ -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" + + + diff --git a/.forgejo/workflows/monthly_data_maintenance.yml b/.forgejo/workflows/monthly_data_maintenance.yml index d01928357b..32d93ef8a1 100644 --- a/.forgejo/workflows/monthly_data_maintenance.yml +++ b/.forgejo/workflows/monthly_data_maintenance.yml @@ -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/ -