Merge pull request #50 from kong-education/create-pull-request/patch #8
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
name: Deploy Customers API to Kong | |
on: | |
push: | |
branches: | |
- main | |
- feat/* | |
paths: | |
- '.github/artifacts/customer/*.yaml' | |
- '.github/workflows/deploy-customer.yaml' | |
workflow_dispatch: | |
jobs: | |
deploy-api-to-kong: | |
name: Deploy Customer API to Kong | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Check if file exists | |
id: check_file | |
run: | | |
if [ ! -f ".github/artifacts/customer/customer-kong.yaml" ]; then | |
echo "Artifact file not found! Stopping workflow.. Run the build workflow before deploy !" | |
exit 1 | |
else | |
echo "Artifact file exists!" | |
fi | |
- name: Setup deck | |
uses: kong/setup-deck@v1 | |
with: | |
deck-version: '1.40.3' | |
wrapper: false | |
- name: Validate connectivity to Konnect | |
run: | | |
deck gateway ping \ | |
--konnect-control-plane-name ${{vars.KONNECT_INTERNAL_CP}} \ | |
--konnect-token ${{ secrets.KONNECT_PAT }} \ | |
--konnect-addr ${{vars.KONNECT_ADDR_EU}} | |
- name: Apply Configuration to Kong | |
run: | | |
deck gateway sync --select-tag sales --select-tag customer \ | |
.github/artifacts/customer/customer-kong.yaml \ | |
--konnect-control-plane-name ${{vars.KONNECT_INTERNAL_CP}} \ | |
--konnect-token ${{ secrets.KONNECT_PAT }} \ | |
--konnect-addr ${{vars.KONNECT_ADDR_EU}} | |
- name: Sleep for a couple of seconds | |
run: sleep 5 | |
- name: Run Integration Tests | |
run: | | |
for test_script in sales/customer/tests/*.sh; do | |
echo "Running $test_script" | |
bash "$test_script" | |
if [ $? -ne 0 ]; then | |
echo "Test $test_script failed" | |
exit 1 | |
fi | |
done | |