From 5f79c629ffe50d42525cd691ba81e307709a7567 Mon Sep 17 00:00:00 2001 From: Unai Martinez-Corral Date: Sun, 13 Feb 2022 14:19:39 +0100 Subject: [PATCH] ci: add GitHub Actions workflow 'Containers' Signed-off-by: Unai Martinez-Corral --- .github/workflows/containers.yml | 37 ++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) create mode 100644 .github/workflows/containers.yml diff --git a/.github/workflows/containers.yml b/.github/workflows/containers.yml new file mode 100644 index 00000000000..9f8a949e39f --- /dev/null +++ b/.github/workflows/containers.yml @@ -0,0 +1,37 @@ +name: Containers + +on: + push: + pull_request: + workflow_dispatch: + schedule: + - cron: '0 0 * * 0' # weekly + +jobs: + + Image: + runs-on: ubuntu-latest + env: + DOCKER_BUILDKIT: 1 + steps: + + - name: 🧰 Repository Checkout + uses: actions/checkout@v2 + + - name: 🔧 Generate image name + id: generate + run: | + REPO='${{ github.repository }}' + echo "::set-output name=image::ghcr.io/${REPO,,}/ubuntu/focal/build" + + - name: ⛴️ Build container image + run: docker build -t ${{ steps.generate.outputs.image }} -f Dockerfile . + + - name: 🛰️ Push container image + if: github.event_name != 'pull_request' + uses: pyTooling/Actions/with-post-step@r0 + with: + main: | + echo '${{ github.token }}' | docker login ghcr.io -u GitHub-Actions --password-stdin + docker push ${{ steps.generate.outputs.image }} + post: docker logout ghcr.io