Nightly JAX build (schedule) #264
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: Nightly JAX build | |
run-name: Nightly JAX build (${{ github.event_name == 'workflow_run' && format('nightly {0}', github.event.workflow_run.created_at) || github.event_name }}) | |
on: | |
schedule: | |
- cron: '30 9 * * *' # Pacific Time 01:30 AM in UTC | |
workflow_dispatch: | |
inputs: | |
PUBLISH: | |
type: boolean | |
description: Publish dated images and update the 'latest' tag? | |
default: false | |
required: false | |
permissions: | |
contents: read # to fetch code | |
actions: write # to cancel previous workflows | |
packages: write # to upload container | |
jobs: | |
metadata: | |
runs-on: ubuntu-22.04 | |
outputs: | |
BUILD_DATE: ${{ steps.date.outputs.BUILD_DATE }} | |
PUBLISH: ${{ steps.if-publish.outputs.PUBLISH }} | |
steps: | |
- name: Set build date | |
id: date | |
shell: bash -x -e {0} | |
run: | | |
BUILD_DATE=$(TZ='US/Los_Angeles' date '+%Y-%m-%d') | |
echo "BUILD_DATE=${BUILD_DATE}" >> $GITHUB_OUTPUT | |
- name: Determine whether results will be 'published' | |
id: if-publish | |
shell: bash -x -e {0} | |
run: | | |
echo "PUBLISH=${{ github.event_name == 'schedule' || (github.event_name == 'workflow_dispatch' && inputs.PUBLISH) }}" >> $GITHUB_OUTPUT | |
build: | |
needs: metadata | |
uses: ./.github/workflows/_build_jax.yaml | |
with: | |
BUILD_DATE: ${{ needs.metadata.outputs.BUILD_DATE }} | |
secrets: inherit | |
publish: | |
if: github.event_name == 'schedule' || (github.event_name == 'workflow_dispatch' && inputs.PUBLISH) | |
needs: [metadata, build] | |
uses: ./.github/workflows/_publish_container.yaml | |
secrets: inherit | |
with: | |
SOURCE_IMAGE: ${{ needs.build.outputs.DOCKER_TAGS }} | |
TARGET_IMAGE: jax | |
TARGET_TAGS: | | |
type=raw,value=latest,priority=1000 | |
type=raw,value=nightly-${{ needs.metadata.outputs.BUILD_DATE }},priority=900 | |
finalize: | |
if: always() | |
needs: [metadata, build] | |
uses: ./.github/workflows/_finalize.yaml | |
with: | |
PUBLISH_BADGE: ${{ needs.metadata.outputs.PUBLISH == 'true' }} | |
secrets: inherit |