Skip to content

Commit

Permalink
ci: build and push docker images
Browse files Browse the repository at this point in the history
  • Loading branch information
emmanuelgautier committed Mar 12, 2024
1 parent cc51d47 commit 2a9d1d2
Showing 1 changed file with 55 additions and 0 deletions.
55 changes: 55 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
name: CI

on:
push:
branches:
- main
pull_request:
branches:
- main

jobs:
list-examples:
runs-on: ubuntu-latest

outputs:
matrix: ${{ steps.set-matrix.outputs.matrix }}

steps:
- uses: actions/checkout@v4

- id: set-matrix
run: echo "matrix=$(ls examples/ | jq -R -s -c 'split("\n")[:-1]')" >> $GITHUB_OUTPUT

docker-build-push:
needs: list-examples
runs-on: ubuntu-latest

permissions:
packages: write

strategy:
matrix:
example: ${{ fromJson(needs.list-examples.outputs.matrix) }}

steps:
- uses: actions/checkout@v4

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

- name: Login to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Build and push
uses: docker/build-push-action@v5
with:
context: ./examples/${{ matrix.example }}
push: ${{ github.ref == 'refs/heads/main' }}
tags: ghcr.io/cerberauth/openid-connect-examples/${{ matrix.example }}:latest
cache-from: type=registry,ref=ghcr.io/cerberauth/openid-connect-examples/${{ matrix.example }}:latest
cache-to: type=inline

0 comments on commit 2a9d1d2

Please sign in to comment.