Skip to content

Commit

Permalink
add deploy step with some temporary code
Browse files Browse the repository at this point in the history
  • Loading branch information
wozniakpl committed Jun 17, 2024
1 parent 6eef038 commit a3d19d0
Showing 1 changed file with 50 additions and 0 deletions.
50 changes: 50 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -163,3 +163,53 @@ jobs:
--target dist \
--push \
./
deploy:
runs-on: ubuntu-latest
needs: [unit_tests, isort, black, flake8, mypy]
if: |
github.event_name == 'push' &&
(
github.ref == 'refs/heads/ci' ||
github.ref == 'refs/heads/develop' ||
github.ref == 'refs/heads/staging' ||
github.ref == 'refs/heads/master'
)
steps:
- name: Trigger deploy
run: |
if [ ${{ github.ref }} == 'refs/heads/develop' ]; then
pipelineId=TODO
elif [ ${{ github.ref }} == 'refs/heads/staging' ]; then
pipelineId=TODO
elif [ ${{ github.ref }} == 'refs/heads/master' ]; then
pipelineId=TODO
elif [ ${{ github.ref }} == 'refs/heads/ci' ]; then
pipelineId=WIP
else
echo "No pipeline to trigger for ref ${{ github.ref }}"
exit 0
fi
IFS=',' read -ra pipelines <<< "$pipelineId"
for pipeline in "${pipelines[@]}"; do
jsonBody='{"variables": {"sha": {"isSecret": false, "value": "${{ github.sha }}"}, "tag": {"isSecret": false, "value": "flex-registration-${{ github.sha }}"}}}'
contentLength=$(echo -n $jsonBody | wc -c)
project=ICTD-HCT-MIS
organization=unicef
echo Triggering deploy for pipeline $pipeline
echo JSON body: $jsonBody
curl -f -v -L \
-u ":${{ secrets.AZURE_PAT }}" \
-H "Content-Type: application/json" \
-H "Content-Length: $contentLength" \
-d "$jsonBody" \
https://dev.azure.com/$organization/$project/_apis/pipelines/$pipeline/runs?api-version=7.1-preview.1
if [ $? -ne 0 ]; then
echo "Failed to trigger deploy for pipeline $pipeline"
exit 1
fi
done

0 comments on commit a3d19d0

Please sign in to comment.