Scripts: use commons action for setup

This commit is contained in:
Pieter Vander Vennet 2025-04-26 22:54:53 +02:00
parent 8d6f9ea94f
commit fb99350d8a
6 changed files with 57 additions and 46 deletions

View file

@ -0,0 +1,17 @@
name: 'Setup'
description: 'Checkout code, set up Nodejs run `npm ci`'
runs:
using: 'composite'
steps:
- uses: https://source.mapcomplete.org/actions/checkout@v4
- name: Checkout up Node.js
uses: https://source.mapcomplete.org/actions/setup-node@v4
with:
node-version: "20"
cache: "npm"
cache-dependency-path: package-lock.json
- name: install deps
run: npm ci
shell: bash

View file

@ -4,21 +4,10 @@ on:
- cron: "0 2 * * *"
jobs:
daily_data_maintenance:
create_community_index:
runs-on: [ ubuntu-latest, hetzner-access ]
steps:
- uses: https://source.mapcomplete.org/actions/checkout@v4
- name: Set up Node.js
uses: https://source.mapcomplete.org/actions/setup-node@v4
with:
node-version: "20"
cache: "npm"
cache-dependency-path: package-lock.json
- name: install deps
run: npm ci
shell: bash
- uses: ./.forgejo/snippets/setup
- name: create community index files
shell: bash
@ -31,6 +20,10 @@ jobs:
scp community-index.zip hetzner:data/
ssh hetzner "cd data && rm -rf community-index/ && unzip community-index.zip && rm community-index.zip"
update_statistics:
runs-on: [ ubuntu-latest, hetzner-access ]
steps:
- uses: ./.forgejo/snippets/setup
- name: Update statistics
shell: bash

View file

@ -9,18 +9,7 @@ jobs:
deploy_on_hosted:
runs-on: [ubuntu-latest, hetzner-access]
steps:
- uses: https://source.mapcomplete.org/actions/checkout@v4
- name: Set up Node.js
uses: https://source.mapcomplete.org/actions/setup-node@v4
with:
node-version: "20"
cache: "npm"
cache-dependency-path: package-lock.json
- name: install deps
run: npm ci
shell: bash
- uses: ./.forgejo/snippets/setup
- name: create generated dir
run: mkdir -p ./assets/generated

View file

@ -7,18 +7,7 @@ jobs:
deploy_single_theme:
runs-on: [ ubuntu-latest, hetzner-access ]
steps:
- uses: https://source.mapcomplete.org/actions/checkout@v4
- name: Set up Node.js
uses: https://source.mapcomplete.org/actions/setup-node@v4
with:
node-version: "20"
cache: "npm"
cache-dependency-path: package-lock.json
- name: install deps
run: npm ci
shell: bash
- uses: ./.forgejo/snippets/setup
- name: create generated dir
run: mkdir ./assets/generated

View file

@ -0,0 +1,30 @@
on:
workflow_dispatch:
schedule:
- cron: "0 2 1 * *"
jobs:
monthly_data_maintenance:
runs-on: [ ubuntu-latest, hetzner-access ]
steps:
- uses: ./.forgejo/snippets/setup
- name: create community index files
shell: bash
run: npm run download:community-index -- -- community-index/
- 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"
- name: Update statistics
shell: bash
run: |
scp -r hetzner:~/data/changeset-metadata/ .
npm run download:stats -- -- ./
scp -r ./changeset-metadata/* hetzner:~/data/changeset-metadata/

View file

@ -8,18 +8,11 @@ jobs:
daily_data_maintenance:
runs-on: [ lain ]
steps:
- uses: https://source.mapcomplete.org/actions/checkout@v4
- name: Set up Node.js
uses: https://source.mapcomplete.org/actions/setup-node@v4
with:
node-version: "20"
cache: "npm"
cache-dependency-path: package-lock.json
- uses: ./.forgejo/snippets/setup
- name: Init all dependencies and layers
shell: bash
run: npm ci && npm run init
run: npm run init
- name: Create export script
shell: bash