blob: 2c81873f879719a49a7ae1a097776912bf096cb4 [file] [log] [blame]
# Copyright 2022 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# ==============================================================================
name: Upload SIG Build docker containers modified for release branches
on:
workflow_dispatch:
push:
paths:
- '.github/workflows/sigbuild-docker-branch.yml'
- 'tensorflow/tools/tf_sig_build_dockerfiles/**'
- '!tensorflow/tools/tf_sig_build_dockerfiles/README.md'
branches:
- "r[1-9].[0-9]+"
permissions:
contents: read
jobs:
docker:
if: github.repository == 'tensorflow/tensorflow' # Don't do this in forks
runs-on: ubuntu-latest
strategy:
matrix:
python-version: [python3.9, python3.10, python3.11, python3.12]
steps:
- name: Delete unnecessary tools folder
run: rm -rf /opt/hostedtoolcache
-
name: Checkout
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
-
name: Set up Docker Buildx
uses: docker/setup-buildx-action@d70bba72b1f3fd22344832f00baa16ece964efeb # v3.3.0
-
name: Login to DockerHub
uses: docker/login-action@0d4c9c5ea7693da7b068278f7b52bda2a190a446 # v3.2.0
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
-
name: Login to GCR
uses: docker/login-action@0d4c9c5ea7693da7b068278f7b52bda2a190a446 # v3.2.0
with:
registry: gcr.io
username: _json_key
password: ${{ secrets.GCP_CREDS }}
-
name: Generate variables for cache busting and tag naming
run: |
echo "DATE=$(date +'%Y-%m-%d')" >> "$GITHUB_OUTPUT"
# Converts r2.9 to just 2.9
echo "REF=$(echo $GITHUB_REF_NAME | sed 's/r//g')" >> "$GITHUB_OUTPUT"
id: vars
-
name: Build and push
id: docker_build
uses: docker/build-push-action@15560696de535e4014efeff63c48f16952e52dd1 # v6.2.0
with:
push: true
context: ./tensorflow/tools/tf_sig_build_dockerfiles
target: devel
build-args: |
PYTHON_VERSION=${{ matrix.python-version }}
CACHEBUSTER=${{ steps.vars.outputs.DATE }}
tags: |
tensorflow/build:${{ steps.vars.outputs.REF }}-${{ matrix.python-version }}
gcr.io/tensorflow-sigs/build:${{ steps.vars.outputs.REF }}-${{ matrix.python-version }}
cache-from: type=registry,ref=tensorflow/build:${{ steps.vars.outputs.REF }}-${{ matrix.python-version }}
cache-to: type=inline
-
name: Image digest
run: echo ${{ steps.docker_build.outputs.digest }}