From b5ae3c25b619dbde34d2b077adba458495a893e3 Mon Sep 17 00:00:00 2001 From: XdoctorwhoZ Date: Tue, 12 Dec 2023 07:12:17 +0100 Subject: [PATCH] restore workflows to build docker images --- .github/workflows/build-latest-image.yml | 50 ++++++++++++++++++++++ .github/workflows/build-release-image.yml | 51 +++++++++++++++++++++++ 2 files changed, 101 insertions(+) create mode 100644 .github/workflows/build-latest-image.yml create mode 100644 .github/workflows/build-release-image.yml diff --git a/.github/workflows/build-latest-image.yml b/.github/workflows/build-latest-image.yml new file mode 100644 index 0000000..6694e0c --- /dev/null +++ b/.github/workflows/build-latest-image.yml @@ -0,0 +1,50 @@ +name: Build Platform Image from lastest MAIN + +# IF PUSH ON MAIN +on: + push: + branches: [ "main" ] + +env: + # Use docker.io for Docker Hub if empty + REGISTRY: ghcr.io + # github.repository as / + REPO: ${{ github.repository }} + +jobs: + build-and-push-image: + runs-on: ubuntu-latest + permissions: + contents: read + packages: write + + steps: + - name: Checkout repository + uses: actions/checkout@v3 + + # Login against a Docker registry except on PR + - name: Log into registry ${{ env.REGISTRY }} + uses: docker/login-action@v2 + with: + registry: ${{ env.REGISTRY }} + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + + # Extract metadata (tags, labels) for Docker + - name: Extract Docker metadata for panduza-py-platform + id: meta + uses: docker/metadata-action@v4 + with: + images: "ghcr.io/${{ github.repository_owner }}/panduza-py-platform" + tags : type = raw, value = latest + + # Build and push Docker image with Buildx + - name: Build and push Docker image panduza-py-platform + id: build-and-push + uses: docker/build-push-action@v3 + with: + context: platform + push: true + tags: ${{ steps.meta.outputs.tags }} + labels: ${{ steps.meta.outputs.labels }} + diff --git a/.github/workflows/build-release-image.yml b/.github/workflows/build-release-image.yml new file mode 100644 index 0000000..4156598 --- /dev/null +++ b/.github/workflows/build-release-image.yml @@ -0,0 +1,51 @@ +name: Build Release Image + +# IF TAG PUSHED +on: + push: + tags: + - '*' + +env: + # Use docker.io for Docker Hub if empty + REGISTRY: ghcr.io + # github.repository as / + REPO: ${{ github.repository }} + +jobs: + build-and-push-image: + runs-on: ubuntu-latest + permissions: + contents: read + packages: write + + steps: + - name: Checkout repository + uses: actions/checkout@v3 + + # Login against a Docker registry except on PR + - name: Log into registry ${{ env.REGISTRY }} + uses: docker/login-action@v2 + with: + registry: ${{ env.REGISTRY }} + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + + # Extract metadata (tags, labels) for Docker + - name: Extract Docker metadata for panduza-py-platform + id: meta + uses: docker/metadata-action@v4 + with: + images: "ghcr.io/${{ github.repository_owner }}/panduza-py-platform" + tags : type = raw, value = ${{ github.ref_name }} + + # Build and push Docker image with Buildx + - name: Build and push Docker image panduza-py-platform + id: build-and-push + uses: docker/build-push-action@v3 + with: + context: platform + push: true + tags: ${{ steps.meta.outputs.tags }} + labels: ${{ steps.meta.outputs.labels }} +