This repository has been archived by the owner on Oct 1, 2024. It is now read-only.
feat(ci): bump actions/setup-python from 4 to 5 #39
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: Build and push images | |
on: | |
schedule: | |
# Every week (on Sunday) at 03:00 | |
- cron: '0 3 * * 0' | |
push: | |
workflow_dispatch: | |
jobs: | |
generate-jobs: | |
name: Generate Jobs | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-python@v5 | |
with: | |
python-version: '3.11' | |
- id: set-matrix | |
run: | | |
deps=$(_scripts/dependencies.py --github-actions-matrix .) | |
echo "matrix=$deps" >> "$GITHUB_OUTPUT" | |
outputs: | |
matrix: ${{ steps.set-matrix.outputs.matrix }} | |
# Don't use continue-on-error to continue when one job fails, because this | |
# will make the pipeline pass, even if one job fails | |
push: | |
name: ${{ matrix.dockerfiles }} | |
needs: generate-jobs | |
runs-on: ubuntu-latest | |
permissions: | |
packages: write | |
contents: read | |
strategy: | |
matrix: | |
dockerfiles: ${{ fromJson(needs.generate-jobs.outputs.matrix) }} | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Log in to registry | |
# https://docs.github.com/en/packages/managing-github-packages-using-github-actions-workflows/publishing-and-installing-a-package-with-github-actions | |
run: docker login ghcr.io --username "${{ github.actor }}" --password-stdin <<< "${{ secrets.GITHUB_TOKEN }}" | |
- name: Build and push images | |
run: | | |
branch=$(git rev-parse --abbrev-ref HEAD) | |
# do not push the image in PRs | |
push=() | |
if [ "$branch" = main ]; then | |
push=(--push) | |
fi | |
for dockerfile in ${{ matrix.dockerfiles }}; do | |
echo | |
echo | |
echo | |
echo ======================= | |
echo ======================= | |
echo "$dockerfile" | |
echo ======================= | |
echo ======================= | |
echo | |
echo | |
echo | |
_scripts/build.sh --image "$dockerfile" "${push[@]}" ghcr.io/"${{ github.repository_owner }}" | |
done |