Skip to content

Commit

Permalink
Merge pull request #122 from PDOK/action-split
Browse files Browse the repository at this point in the history
split the github action
  • Loading branch information
Shalucik authored Jun 12, 2024
2 parents 960f419 + d8defaf commit f47df6b
Show file tree
Hide file tree
Showing 2 changed files with 71 additions and 32 deletions.
70 changes: 70 additions & 0 deletions .github/workflows/build-and-publish-dockerhub.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
name: Push Docker Image

on:
release:
types: [created]

env:
image: pdok/geopackage-validator

jobs:
deploy:

runs-on: ubuntu-22.04

steps:
- name: Checkout 🛎️
uses: actions/checkout@v3
- name: Docker meta
id: docker_meta
uses: docker/metadata-action@v3
with:
images: ${{ env.image }}
tags: |
type=semver,pattern={{version}}
- name: Login to PDOK DockerHub
if: startsWith(env.image, 'pdok/')
uses: docker/login-action@v1
with:
username: koalapdok
password: ${{ secrets.DOCKERHUB_PUSH }}
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
- name: Cache Docker layers
uses: actions/cache@v2
with:
path: /tmp/.buildx-cache
key: ${{ runner.os }}-buildx-${{ github.sha }}
restore-keys: |
${{ runner.os }}-buildx-
- name: Build and push
id: docker_build
uses: docker/build-push-action@v2
with:
push: true
tags: ${{ steps.docker_meta.outputs.tags }}
labels: ${{ steps.docker_meta.outputs.labels }}
cache-from: type=local,src=/tmp/.buildx-cache
cache-to: type=local,dest=/tmp/.buildx-cache-new
- # Temp fix to cleanup cache
# https://github.com/docker/build-push-action/issues/252
# https://github.com/moby/buildkit/issues/1896
name: Move cache
run: |
rm -rf /tmp/.buildx-cache
mv /tmp/.buildx-cache-new /tmp/.buildx-cache
- name: Build result notification
if: success() || failure()
uses: 8398a7/action-slack@v3
with:
fields: all
status: custom
custom_payload: |
{
attachments: [{
color: '${{ job.status }}' === 'success' ? 'good' : '${{ job.status }}' === 'failure' ? 'danger' : 'warning',
text: `${process.env.AS_WORKFLOW} ${{ job.status }} for ${process.env.AS_REPO}!\n${process.env.AS_JOB} job on ${process.env.AS_REF} (commit: ${process.env.AS_COMMIT}, version: ${{ steps.docker_meta.outputs.version }}) by ${process.env.AS_AUTHOR} took ${process.env.AS_TOOK}`,
}]
}
env:
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# This workflows will upload a Python Package using Twine when a release is created
# For more information see: https://help.github.com/en/actions/language-and-framework-guides/using-python-with-github-actions#publishing-to-package-registries

name: Upload Python Package and Push Docker Image
name: Upload Python Package

on:
release:
Expand Down Expand Up @@ -51,37 +51,6 @@ jobs:
images: ${{ env.image }}
tags: |
type=semver,pattern={{version}}
- name: Login to PDOK DockerHub
if: startsWith(env.image, 'pdok/')
uses: docker/login-action@v1
with:
username: koalapdok
password: ${{ secrets.DOCKERHUB_PUSH }}
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
- name: Cache Docker layers
uses: actions/cache@v2
with:
path: /tmp/.buildx-cache
key: ${{ runner.os }}-buildx-${{ github.sha }}
restore-keys: |
${{ runner.os }}-buildx-
- name: Build and push
id: docker_build
uses: docker/build-push-action@v2
with:
push: true
tags: ${{ steps.docker_meta.outputs.tags }}
labels: ${{ steps.docker_meta.outputs.labels }}
cache-from: type=local,src=/tmp/.buildx-cache
cache-to: type=local,dest=/tmp/.buildx-cache-new
- # Temp fix to cleanup cache
# https://github.com/docker/build-push-action/issues/252
# https://github.com/moby/buildkit/issues/1896
name: Move cache
run: |
rm -rf /tmp/.buildx-cache
mv /tmp/.buildx-cache-new /tmp/.buildx-cache
- name: Build result notification
if: success() || failure()
uses: 8398a7/action-slack@v3
Expand Down

0 comments on commit f47df6b

Please sign in to comment.