Skip to content

πŸ–₯ + πŸ—“ - Weekly #190

πŸ–₯ + πŸ—“ - Weekly

πŸ–₯ + πŸ—“ - Weekly #190

name: πŸ–₯ + πŸ—“ - Weekly
# (Name of the workflow)-(fully formed ref (ie. refs/heads/main,refs/tags/v10,refs/pull/<pr_number>/merge))
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
on:
schedule:
# Run daily at 12:37 UTC (noon)
# We avoid running directly on the hour because that is when
# many other workloads run and github advises against it running
# exactly on the hour.
# Using noon instead of midnight avoids day boundary issues with
# GHA's scheduling volatility (+/- 90-120 minutes).
- cron: "37 12 * * *"
workflow_dispatch:
inputs:
batch_file:
description: 'Batch file to build (e.g., mon). If not specified, will be determined from current day.'
required: false
type: choice
options:
- 'mon'
- 'tue'
- 'wed'
- 'thu'
- 'fri'
- 'sat'
- 'sun'
jobs:
what-to-build:
name: πŸ”Ž - Find Build Surface
runs-on: ubuntu-latest
steps:
-
name: πŸ›’ - Checkout
uses: actions/checkout@1af3b93b6815bc44a9784bd300feb67ff0d1eeb3
-
name: πŸ”’ - Find Matching Batch File
id: find-batch
shell: bash
run: |
if [ -n "${{ inputs.batch_file }}" ]; then
# Use provided batch file from workflow_dispatch
BATCH_FILE=".build-batch-${{ inputs.batch_file }}"
else
# Determine batch file from current UTC day of week
# Format: day (e.g., mon, tue, wed)
DAY_NAME=$(date -u +%a | tr '[:upper:]' '[:lower:]' | cut -c1-3) # mon, tue, wed, thu, fri, sat, sun
BATCH_FILE=".build-batch-${DAY_NAME}"
fi
if [ ! -f "$BATCH_FILE" ]; then
echo "No batch file found for current time: $BATCH_FILE"
echo "Skipping build (this is expected for most hours)"
echo "should_build=false" >> $GITHUB_OUTPUT
exit 0
fi
echo "batch_file=$BATCH_FILE" >> $GITHUB_OUTPUT
echo "should_build=true" >> $GITHUB_OUTPUT
echo "Found batch file: $BATCH_FILE"
-
name: πŸ“‚ - Read Batch Languages
id: find-languages
if: steps.find-batch.outputs.should_build == 'true'
shell: bash
run: |
BATCH_FILE="${{ steps.find-batch.outputs.batch_file }}"
# Read batch file, filter out comments and empty lines, validate against .no-publish
json_array=$(grep -v '^#' "$BATCH_FILE" | grep -v '^$' | grep -vxFf .no-publish | jq -Rcs 'split("\n")[:-1]')
echo "languages=$json_array" >> $GITHUB_OUTPUT
echo "Found $(echo "$json_array" | jq 'length') languages in $BATCH_FILE"
outputs:
should_build: ${{ steps.find-batch.outputs.should_build }}
languages: ${{ steps.find-languages.outputs.languages || '[]' }}
build-test-publish:
name: πŸš€ - Build, Run and Publish
if: needs.what-to-build.outputs.should_build == 'true'
uses: ./.github/workflows/build-test-publish.yml
needs: what-to-build
secrets: inherit
with:
languages: ${{ needs.what-to-build.outputs.languages }}
publish: true