Skip to content

limit push trigger to main branch for updating base python images #51

limit push trigger to main branch for updating base python images

limit push trigger to main branch for updating base python images #51

name: "Update base Python container images"
on:
push:
branches:
- 'main'
schedule:
- cron: '0 0 * * MON'
workflow_dispatch:
jobs:
task:
strategy:
matrix:
py_version:
- "3.8"
- "3.9"
- "3.10"
- "3.11"
- "3.12"
permissions:
contents: write
pull-requests: write
packages: write
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Auth to Cloud
uses: 'uwit-iam/action-auth-artifact-registry@main'
with:
credentials: "${{ secrets.MCI_GCLOUD_AUTH_JSON }}"
- name: Record timestamp for image
id: timestamp
run: |
echo "value=$(date +%Y.%m.%d.%H.%M.%S)" >> $GITHUB_OUTPUT # e.g., 2024.01.17.15.09.31
- name: Build and push docker image
env:
image_uri: "us-docker.pkg.dev/uwit-mci-iam/containers/base-python-${{ matrix.py_version }}"
run: |
docker build \
images/python-base/ \
-f images/python-base/Dockerfile \
-t "${{ env.image_uri }}:latest" \
-t "${{ env.image_uri }}:${{ steps.timestamp.outputs.value }}" \
--build-arg TIMESTAMP="${{ steps.timestamp.outputs.value }}" \
--build-arg PYTHON_VERSION="${{ matrix.py_version }}"
docker push --all-tags "${{ env.image_uri }}"