Skip to content

Update Container (master) #30820

Update Container (master)

Update Container (master) #30820

name: Update Container (master)
on:
schedule:
- cron: '10 * * * *' # Every Hour
workflow_dispatch:
jobs:
check-upstream:
name: Check for new upstream revision
runs-on: ubuntu-latest
outputs:
modified: ${{ steps.git-check.outputs.modified }}
steps:
- uses: actions/checkout@v2
- name: Fetch upstream revision
run: |
git fetch
curl -sL 'https://api.github.com/repos/apache/superset/actions/workflows/docker.yml/runs?branch=master&conclusion=success&status=completed&per_page=1' | \
jq '.workflow_runs | .[] | del(.pull_requests, .html_url, .repository, .head_repository)' > superset-master.json
- name: Check for modified files
id: git-check
run: echo ::set-output name=modified::$([ -z "`git status --porcelain`" ] && echo "unchanged" || echo "true")
- name: Commit latest upstream revision
if: steps.git-check.outputs.modified == 'true'
run: |
git config --global user.name '${{ github.actor }}'
git config --global user.email '${{ github.actor }}@users.noreply.github.com'
git commit -am "New upstream revision"
git push
publish-image:
name: Publish to ghcr.io
needs: check-upstream
if: needs.check-upstream.outputs.modified == 'true'
strategy:
matrix:
DOCKER_IMAGE: [superset-oauth] # Array: [superset,superset-oauth]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Publish to GitHub Registry
uses: elgohr/Publish-Docker-Github-Action@v5
with:
name: ghcr.io/${{ github.repository_owner }}/${{ matrix.DOCKER_IMAGE }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
registry: ghcr.io
dockerfile: Dockerfile.${{ matrix.DOCKER_IMAGE }}
tags: "master"