Trying new
This commit is contained in:
parent
fbf198a6c0
commit
0e0a5a8b87
1 changed files with 28 additions and 6 deletions
30
.github/workflows/api-deploy-nonprod.yml
vendored
30
.github/workflows/api-deploy-nonprod.yml
vendored
|
|
@ -102,10 +102,32 @@ jobs:
|
||||||
contents: read
|
contents: read
|
||||||
packages: write
|
packages: write
|
||||||
steps:
|
steps:
|
||||||
- name: Deploy to Team City
|
- name: Trigger TeamCity Build
|
||||||
|
id: trigger
|
||||||
run: |
|
run: |
|
||||||
curl -u ${{ secrets.TEAMCITY_USERNAME }}:${{ secrets.TEAMCITY_PASSWORD }} \
|
echo "Triggering TeamCity build..."
|
||||||
|
|
||||||
|
# Trigger build and get the build ID
|
||||||
|
BUILD_ID=$(curl -s -u "$TEAMCITY_USER:$TEAMCITY_TOKEN" \
|
||||||
-X POST \
|
-X POST \
|
||||||
-H "Content-Type: application/json" \
|
-H "Content-Type: application/json" \
|
||||||
-d '{"buildType": {"id": "${{ secrets.TEAMCITY_API_ID }}"}}' \
|
-d "{\"buildType\": {\"id\": \"$TEAMCITY_BUILD_ID\"}}" \
|
||||||
"${{ secrets.TEAMCITY_URL }}/httpAuth/app/rest/buildQueue?fields=build(state)"
|
"$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 }}"
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue