Auto deploy AAS test apps #140
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: Auto deploy AAS test apps | |
on: | |
workflow_dispatch: | |
schedule: | |
- cron: '0 0 * * TUE' | |
- cron: '0 0 * * FRI' | |
jobs: | |
deploy_aas_test_apps: | |
runs-on: ubuntu-latest | |
permissions: | |
contents: read | |
actions: read # read secrets | |
issues: read # Read milestones milestones | |
env: | |
GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}" | |
steps: | |
- name: Clone dd-trace-dotnet repository | |
uses: actions/checkout@v3 | |
- uses: octokit/request-action@v2.x | |
name: 'Open Code Freeze Milestone' | |
id: milestones | |
if: github.event_name != 'workflow_dispatch' | |
with: | |
route: GET /repos/{owner}/{repo}/milestones | |
owner: DataDog | |
repo: dd-trace-dotnet | |
state: open | |
env: | |
GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}" | |
- name: 'Check if code freeze is in place' | |
if: github.event_name != 'workflow_dispatch' # don't check if triggered manually | |
run: | | |
json=$(cat << 'ENDOFMESSAGE' | |
${{ steps.milestones.outputs.data }} | |
ENDOFMESSAGE | |
) | |
if addr=$(echo $json | jq -er '.[] | select(.title == "Code Freeze")'); then | |
echo "A code freeze is in place, we should not trigger a deployment." | |
echo "stop=true" >> "$GITHUB_ENV" | |
else | |
echo "No code freeze in place. Triggering a deployment." | |
fi | |
- uses: ./.github/actions/deploy-aas-dev-apps | |
name: 'Trigger AAS deploy' | |
if: env.stop != 'true' | |
with: | |
aas_github_token: ${{ secrets.GH_EXTERNAL_TOKEN }} |