pokeapi-api-data/.circleci/config.yml
2024-05-07 21:40:29 +02:00

54 lines
1.5 KiB
YAML

version: 2.1
executors:
python3:
docker:
- image: cimg/python:3.12.3
commands:
ditto-transform:
description: Run Ditto in order to transform the BASE_URL instead of http://localhost
steps:
- run:
name: Install Ditto
command: pip install --user 'pokeapi-ditto==1.0.3'
- run:
name: Transform api-data's JSON files to have the correct BASE_URL instead of http://localhost
command: bash -x scripts/transform.sh
jobs:
test:
executor: python3
steps:
- checkout
- ditto-transform
build-and-deploy:
executor: python3
steps:
- checkout
- ditto-transform
- run:
name: Pack the transformed data in a .tar.gz
command: tar czf _gen.tar.gz _gen/*
- store_artifacts:
path: _gen.tar.gz
# Trigger a new build of the deploy job of the deploy project
- run:
name: Trigger a deploy of the deploy project passing the desired environment/location to deploy to
command: |
curl -H 'Content-Type: application/json' -H "Circle-Token: $CIRCLECI_API_TOKEN_NARAMSIM" --data "{\"branch\":\"master\",\"parameters\":{\"deploy_location\":\"$CIRCLE_BRANCH\"}}" -X POST https://circleci.com/api/v2/project/github/PokeAPI/deploy/pipeline
workflows:
version: 2
test-build-and-deploy:
jobs:
- test
- build-and-deploy:
requires:
- test
filters:
branches:
only:
- master
- staging