forked from MapComplete/MapComplete
Scripts: use commons action for setup
This commit is contained in:
parent
8d6f9ea94f
commit
fb99350d8a
6 changed files with 57 additions and 46 deletions
17
.forgejo/snippets/setup.yml
Normal file
17
.forgejo/snippets/setup.yml
Normal 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
|
||||
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
30
.forgejo/workflows/monthly_data_maintenance.yml
Normal file
30
.forgejo/workflows/monthly_data_maintenance.yml
Normal 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/
|
||||
|
|
@ -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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue