trigger build pg 14 - use native python pkgs #23
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
# Workflow with selective build/push: only if subpath | |
# changed build that Docker Image version only. | |
# | |
# Author: Just van den Broecke - 2021 | |
# | |
name: Docker Build Push ⚓ | |
on: | |
push: | |
branches: [ master ] | |
jobs: | |
# JOB to run change detection | |
changes: | |
# Uses: https://github.com/marketplace/actions/paths-changes-filter | |
runs-on: ubuntu-latest | |
# Set job outputs to values from filter step | |
outputs: | |
pg9: ${{ steps.filter.outputs.pg9 }} | |
pg10: ${{ steps.filter.outputs.pg10 }} | |
pg11: ${{ steps.filter.outputs.pg11 }} | |
pg12: ${{ steps.filter.outputs.pg12 }} | |
pg13: ${{ steps.filter.outputs.pg13 }} | |
pg14: ${{ steps.filter.outputs.pg14 }} | |
pg15: ${{ steps.filter.outputs.pg15 }} | |
pg16: ${{ steps.filter.outputs.pg16 }} | |
steps: | |
- name: Checkout 📦 | |
uses: actions/checkout@v2 | |
- name: Pathfilter 📦 | |
uses: dorny/paths-filter@v2 | |
id: filter | |
with: | |
filters: | | |
pg9: | |
- '9.6/**' | |
pg10: | |
- '10/**' | |
pg11: | |
- '11/**' | |
pg12: | |
- '12/**' | |
pg13: | |
- '13/**' | |
pg14: | |
- '14/**' | |
pg15: | |
- '15/**' | |
pg16: | |
- '16/**' | |
# Job for Docker Build and Push | |
build: | |
needs: changes | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout 📦 | |
uses: actions/checkout@v2 | |
- name: Prepare 📦 | |
id: prep | |
run: | | |
DOCKER_IMAGE="justb4/pgbackup" | |
VERSION="unknown" | |
pg9=${{ needs.changes.outputs.pg9 }} | |
pg10=${{ needs.changes.outputs.pg10 }} | |
pg11=${{ needs.changes.outputs.pg11 }} | |
pg12=${{ needs.changes.outputs.pg12 }} | |
pg13=${{ needs.changes.outputs.pg13 }} | |
pg14=${{ needs.changes.outputs.pg14 }} | |
pg15=${{ needs.changes.outputs.pg15 }} | |
pg16=${{ needs.changes.outputs.pg16 }} | |
if [[ $pg9 == true ]]; then | |
VERSION="9.6" | |
elif [[ $pg10 == true ]]; then | |
VERSION="10" | |
elif [[ $pg11 == true ]]; then | |
VERSION="11" | |
elif [[ $pg12 == true ]]; then | |
VERSION="12" | |
elif [[ $pg13 == true ]]; then | |
VERSION="13" | |
elif [[ $pg14 == true ]]; then | |
VERSION="14" | |
elif [[ $pg15 == true ]]; then | |
VERSION="15" | |
elif [[ $pg15 == true ]]; then | |
VERSION="16" | |
fi | |
TAGS="${DOCKER_IMAGE}:${VERSION}" | |
echo ::set-output name=subdir::${VERSION} | |
echo ::set-output name=image::${DOCKER_IMAGE} | |
echo ::set-output name=version::${VERSION} | |
echo ::set-output name=tags::${TAGS} | |
echo ::set-output name=created::$(date -u +'%Y-%m-%dT%H:%M:%SZ') | |
- name: Show Image Settings 📦 | |
run: echo "IMAGE=${{ steps.prep.outputs.image }} VERSION=${{ steps.prep.outputs.version }} TAGS=${{ steps.prep.outputs.tags }} SUBDIR=${{ steps.prep.outputs.subdir }}" | |
- name: Set up Docker Buildx 📦 | |
if: steps.prep.outputs.version != 'unknown' | |
uses: docker/setup-buildx-action@v1 | |
- name: Login to DockerHub 📦 | |
if: steps.prep.outputs.version != 'unknown' | |
uses: docker/login-action@v1 | |
with: | |
username: ${{ secrets.DOCKER_USERNAME }} | |
password: ${{ secrets.DOCKER_PASSWORD }} | |
- name: Docker Build and Push 📦 | |
if: steps.prep.outputs.version != 'unknown' | |
uses: docker/build-push-action@v2 | |
with: | |
context: ${{ steps.prep.outputs.subdir }} | |
load: false | |
push: true | |
tags: ${{ steps.prep.outputs.tags }} | |
labels: | | |
org.opencontainers.image.source=${{ github.event.repository.html_url }} | |
org.opencontainers.image.created=${{ steps.prep.outputs.created }} | |
org.opencontainers.image.revision=${{ github.sha }} |