Skip to content

Commit

Permalink
WIP
Browse files Browse the repository at this point in the history
  • Loading branch information
GDYendell committed Jun 25, 2024
1 parent 0ac8358 commit 63dcd54
Showing 1 changed file with 34 additions and 12 deletions.
46 changes: 34 additions & 12 deletions .github/workflows/container.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,6 @@ name: Container CI

on:
push:
# Build for main, tags and PRs
# Builds from PRs are not pushed to the registry because of rules in the steps
branches:
- main
tags:
- "*"
pull_request:

jobs:
Expand All @@ -17,9 +11,6 @@ jobs:
contents: read
packages: write

env:
TAG: ghcr.io/${{ github.repository_owner }}/${{ github.event.repository.name }}

steps:
- name: Checkout
uses: actions/checkout@v2
Expand Down Expand Up @@ -56,24 +47,55 @@ jobs:
cache-from: type=local,src=/tmp/.buildx-cache
cache-to: type=local,dest=/tmp/.buildx-cache

release:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write

if: ${{ github.event_name == 'push' && github.ref_type == 'tag' }}
needs: [build]

steps:
- name: Create tags for developer image
id: meta-developer
uses: docker/metadata-action@v5
with:
images: ghcr.io/${{ github.repository }}
tags: |
type=ref,event=tag
type=raw,value=latest
- name: Push developer image
if: ${{ github.event_name == 'push' && github.ref_type == 'tag' }}
uses: docker/build-push-action@v4
with:
context: .
file: Dockerfile
target: developer
tags: ${{ env.TAG }}-developer:latest
tags: ${{ steps.meta-developer.outputs.tags }}
labels: ${{ steps.meta-developer.outputs.labels }}
push: ${{ github.event_name != 'pull_request' }}
cache-from: type=local,src=/tmp/.buildx-cache
cache-to: type=local,dest=/tmp/.buildx-cache

- name: Create tags for runtime image
id: meta-runtime
uses: docker/metadata-action@v5
with:
images: ghcr.io/${{ github.repository }}
tags: |
type=ref,event=tag
type=raw,value=latest
- name: Push runtime image
if: ${{ github.event_name == 'push' && github.ref_type == 'tag' }}
uses: docker/build-push-action@v4
with:
context: .
file: Dockerfile
target: runtime
tags: ${{ env.TAG }}-runtime:latest
push: ${{ github.event_name != 'pull_request' }}
tags: ${{ steps.meta-runtime.outputs.tags }}
labels: ${{ steps.meta-runtime.outputs.labels }}
cache-from: type=local,src=/tmp/.buildx-cache
cache-to: type=local,dest=/tmp/.buildx-cache

0 comments on commit 63dcd54

Please sign in to comment.