forked from OpenRailwayMap/OpenRailwayMap-CartoCSS
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Trigger from Github Actions to CircleCI for nightly update
- Loading branch information
Showing
3 changed files
with
76 additions
and
59 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,61 +1,4 @@ | ||
version: 2.1 | ||
|
||
executors: | ||
default: | ||
machine: | ||
image: ubuntu-2204:current | ||
resource_class: medium | ||
|
||
jobs: | ||
import-data: | ||
executor: default | ||
steps: | ||
- checkout | ||
- run: wget -qO- 'https://getfly.fly.dev/linux-x86-64/flyctl.tgz' | tar xz | ||
- run: echo "$GITHUB_TOKEN" | docker login ghcr.io -u "$GITHUB_USERNAME" --password-stdin | ||
- run: docker compose build db | ||
- run: docker compose build import | ||
- run: docker compose build martin-cp | ||
- run: docker compose up --wait db | ||
- run: curl --location --progress-bar https://download.geofabrik.de/europe-latest.osm.pbf --output data/data.osm.pbf | ||
- run: | ||
no_output_timeout: 1h | ||
environment: | ||
OSM2PGSQL_DATAFILE: data.osm.pbf | ||
OSM2PGSQL_CACHE: '7000' | ||
OSM2PGSQL_NUMPROC: '2' | ||
command: docker compose up import | ||
- run: | | ||
docker compose stop db | ||
DB_CONTAINER_ID="$(docker compose ps --all --format json | jq -r 'select(.Service == "db") | .ID')" | ||
DB_IMAGE="$(docker compose ps --all --format json | jq -r 'select(.Service == "db") | .Image')" | ||
# Persist and squash data in new image | ||
docker cp "$DB_CONTAINER_ID:/var/lib/postgresql/postgres-data" db/postgres-data | ||
echo 'COPY postgres-data /var/lib/postgresql/postgres-data' >> db/Dockerfile | ||
docker compose build db | ||
docker compose push db | ||
- run: | | ||
curl -L \ | ||
-X POST \ | ||
-H "Accept: application/vnd.github+json" \ | ||
-H "Authorization: Bearer $GITHUB_TOKEN" \ | ||
-H "X-GitHub-Api-Version: 2022-11-28" \ | ||
https://api.github.com/repos/hiddewie/OpenRailwayMap-vector/actions/workflows/deploy.yml/dispatches \ | ||
-d "$(jq -c -n --arg branch "$CIRCLE_BRANCH" '{ref: $branch}')" | ||
workflows: | ||
auto-deployment: | ||
triggers: | ||
- schedule: | ||
# Run daily at 3:47 UTC | ||
cron: "47 3 * * *" | ||
filters: | ||
branches: | ||
only: | ||
- master | ||
jobs: | ||
- import-data: | ||
context: | ||
- github | ||
jobs: {} | ||
workflows: {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
version: 2.1 | ||
|
||
executors: | ||
default: | ||
machine: | ||
image: ubuntu-2204:current | ||
resource_class: medium | ||
|
||
jobs: | ||
import-data: | ||
executor: default | ||
steps: | ||
- checkout | ||
- run: wget -qO- 'https://getfly.fly.dev/linux-x86-64/flyctl.tgz' | tar xz | ||
- run: echo "$GITHUB_TOKEN" | docker login ghcr.io -u "$GITHUB_USERNAME" --password-stdin | ||
- run: docker compose build db | ||
- run: docker compose build import | ||
- run: docker compose build martin-cp | ||
- run: docker compose up --wait db | ||
- run: curl --location --progress-bar https://download.geofabrik.de/europe-latest.osm.pbf --output data/data.osm.pbf | ||
- run: | ||
no_output_timeout: 1h | ||
environment: | ||
OSM2PGSQL_DATAFILE: data.osm.pbf | ||
OSM2PGSQL_CACHE: '7000' | ||
OSM2PGSQL_NUMPROC: '2' | ||
command: docker compose up import | ||
- run: | | ||
docker compose stop db | ||
DB_CONTAINER_ID="$(docker compose ps --all --format json | jq -r 'select(.Service == "db") | .ID')" | ||
DB_IMAGE="$(docker compose ps --all --format json | jq -r 'select(.Service == "db") | .Image')" | ||
# Persist and squash data in new image | ||
docker cp "$DB_CONTAINER_ID:/var/lib/postgresql/postgres-data" db/postgres-data | ||
echo 'COPY postgres-data /var/lib/postgresql/postgres-data' >> db/Dockerfile | ||
docker compose build db | ||
docker compose push db | ||
- run: | | ||
curl -L \ | ||
-X POST \ | ||
-H "Accept: application/vnd.github+json" \ | ||
-H "Authorization: Bearer $GITHUB_TOKEN" \ | ||
-H "X-GitHub-Api-Version: 2022-11-28" \ | ||
https://api.github.com/repos/hiddewie/OpenRailwayMap-vector/actions/workflows/deploy.yml/dispatches \ | ||
-d "$(jq -c -n --arg branch "$CIRCLE_BRANCH" '{ref: $branch}')" | ||
workflows: | ||
auto-deployment: | ||
jobs: | ||
- import-data: | ||
context: | ||
- github |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
name: Nightly update | ||
|
||
on: | ||
workflow_dispatch: ~ | ||
schedule: | ||
# Run daily at 3:47 UTC | ||
- cron: '47 3 * * *' | ||
|
||
jobs: | ||
trigger-circle-ci: | ||
name: Trigger CircleCI | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- run: | | ||
curl \ | ||
-X POST \ | ||
-H "content-type: application/json" \ | ||
"https://internal.circleci.com/private/soc/e/4137caec-ceea-4722-9803-8ab90a8d2355?secret=$CIRCLECI_WEBHOOK_SECRET" | ||
env: | ||
CIRCLECI_WEBHOOK_SECRET: ${{ secrets.CIRCLECI_WEBHOOK_SECRET }} |