From 0e0a5a8b872c604c6ab5d0555d9b6c3b766145b2 Mon Sep 17 00:00:00 2001 From: Matt DiMeglio Date: Sat, 7 Feb 2026 23:53:05 -0500 Subject: [PATCH] Trying new --- .github/workflows/api-deploy-nonprod.yml | 34 +++++++++++++++++++----- 1 file changed, 28 insertions(+), 6 deletions(-) diff --git a/.github/workflows/api-deploy-nonprod.yml b/.github/workflows/api-deploy-nonprod.yml index d871ca1..82b710e 100644 --- a/.github/workflows/api-deploy-nonprod.yml +++ b/.github/workflows/api-deploy-nonprod.yml @@ -102,10 +102,32 @@ jobs: contents: read packages: write steps: - - name: Deploy to Team City + - name: Trigger TeamCity Build + id: trigger run: | - curl -u ${{ secrets.TEAMCITY_USERNAME }}:${{ secrets.TEAMCITY_PASSWORD }} \ - -X POST \ - -H "Content-Type: application/json" \ - -d '{"buildType": {"id": "${{ secrets.TEAMCITY_API_ID }}"}}' \ - "${{ secrets.TEAMCITY_URL }}/httpAuth/app/rest/buildQueue?fields=build(state)" \ No newline at end of file + echo "Triggering TeamCity build..." + + # Trigger build and get the build ID + BUILD_ID=$(curl -s -u "$TEAMCITY_USER:$TEAMCITY_TOKEN" \ + -X POST \ + -H "Content-Type: application/json" \ + -d "{\"buildType\": {\"id\": \"$TEAMCITY_BUILD_ID\"}}" \ + "$TEAMCITY_URL/httpAuth/app/rest/buildQueue" \ + | xmllint --xpath 'string(//build/@id)' -) + + echo "Build queued with ID: $BUILD_ID" + + # Query only the build state + BUILD_STATE=$(curl -s -u "$TEAMCITY_USER:$TEAMCITY_TOKEN" \ + "$TEAMCITY_URL/httpAuth/app/rest/buildQueue/id:$BUILD_ID?fields=build(state)" \ + | xmllint --xpath 'string(//build/@state)' -) + + echo "Build state: $BUILD_STATE" + + # Set GitHub Actions output + echo "build_state=$BUILD_STATE" >> $GITHUB_OUTPUT + + - name: Show Build State + run: echo "TeamCity build is ${{ steps.trigger.outputs.build_state }}" + +