Scheduled AAS Deployment #16
This file contains hidden or 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: Scheduled AAS Deployment | |
on: | |
schedule: | |
- cron: '30 22 * * FRI' # Every Friday at 10:30 PM UTC | |
workflow_dispatch: | |
inputs: | |
force_deploy: | |
description: '[TESTING] Force deployment regardless of code freeze status' | |
type: boolean | |
default: false | |
override_week: | |
description: '[TESTING] Override week number (empty = use current week, even number = deploy)' | |
required: false | |
type: string | |
jobs: | |
check_freeze_and_deploy: | |
runs-on: ubuntu-latest | |
permissions: | |
contents: read | |
actions: read | |
issues: write | |
steps: | |
- name: Calculate week number | |
id: week | |
run: | | |
if [ ! -z "${{ inputs.override_week }}" ]; then | |
echo "Using override week: ${{ inputs.override_week }}" | |
WEEK_NUM="${{ inputs.override_week }}" | |
else | |
WEEK_NUM=$(date +%V) | |
fi | |
WEEK_NUM=$((10#$WEEK_NUM)) # Convert to decimal to handle leading zeros | |
echo "Week number being used: $WEEK_NUM" | |
echo "week_number=$WEEK_NUM" >> $GITHUB_OUTPUT | |
- name: Check if we should run | |
id: should_run | |
run: | | |
if [[ "${{ github.event_name }}" == "workflow_dispatch" && "${{ inputs.force_deploy }}" == "true" ]]; then | |
echo "should_proceed=true" >> $GITHUB_OUTPUT | |
exit 0 | |
fi | |
# Check if week number is even (proceeding with deployment) | |
if (( ${{ steps.week.outputs.week_number }} % 2 == 0 )); then | |
echo "should_proceed=true" >> $GITHUB_OUTPUT | |
else | |
echo "should_proceed=false" >> $GITHUB_OUTPUT | |
fi | |
# Check skip milestone | |
- uses: octokit/request-action@786351db496fa66730d8faa09ef279108da175a3 # v2.x | |
if: steps.should_run.outputs.should_proceed == 'true' | |
name: 'Check Skip Milestone' | |
id: skip_milestone | |
with: | |
route: GET /repos/{owner}/{repo}/milestones/183 # Skip Scheduled Code Freeze milestone ID | |
owner: ${{ github.repository_owner }} | |
repo: ${{ github.event.repository.name }} | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- name: Process skip state | |
if: steps.should_run.outputs.should_proceed == 'true' | |
id: check_skip | |
run: | | |
state=$(echo '${{ steps.skip_milestone.outputs.data }}' | jq -r '.state') | |
echo "Milestone state: $state" | |
if [ "$state" == "open" ]; then | |
echo "Skip milestone is open - will skip code freeze" | |
echo "should_proceed=false" >> $GITHUB_OUTPUT | |
else | |
echo "Skip milestone is closed - will proceed with code freeze" | |
echo "should_proceed=true" >> $GITHUB_OUTPUT | |
fi | |
# Close skip milestone if we're skipping | |
- uses: octokit/request-action@786351db496fa66730d8faa09ef279108da175a3 # v2.x | |
if: steps.should_run.outputs.should_proceed == 'true' && steps.check_skip.outputs.should_proceed == 'false' | |
name: 'Close Skip Milestone' | |
with: | |
route: PATCH /repos/{owner}/{repo}/milestones/183 # Skip Scheduled Code Freeze milestone ID | |
owner: ${{ github.repository_owner }} | |
repo: ${{ github.event.repository.name }} | |
state: closed | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
# Checkout and deploy if we should proceed | |
- name: Clone repository | |
if: steps.check_skip.outputs.should_proceed == 'true' | |
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 | |
- uses: ./.github/actions/deploy-aas-dev-apps | |
if: steps.check_skip.outputs.should_proceed == 'true' | |
name: 'Trigger AAS deploy' | |
with: | |
aas_github_token: ${{ secrets.GH_EXTERNAL_TOKEN }} |