From b93e24a02c895f54e0c414b2b75f0d34b12ff872 Mon Sep 17 00:00:00 2001 From: jo Date: Thu, 8 Sep 2022 12:52:00 +0200 Subject: [PATCH] ci: add containers build job --- .../actions/build-container/action.yml | 24 ++++++++ .github/workflows/container.yml | 56 +++++++++++++++++++ 2 files changed, 80 insertions(+) create mode 100644 .github/workflows/actions/build-container/action.yml create mode 100644 .github/workflows/container.yml diff --git a/.github/workflows/actions/build-container/action.yml b/.github/workflows/actions/build-container/action.yml new file mode 100644 index 000000000..50785002c --- /dev/null +++ b/.github/workflows/actions/build-container/action.yml @@ -0,0 +1,24 @@ +name: Build container +description: Build and push a container + +inputs: + target: + required: true + images: + required: true + +runs: + using: composite + steps: + - uses: docker/metadata-action@v4 + id: meta + with: + images: ${{ inputs.images }} + + - uses: docker/build-push-action@v3 + with: + context: . + push: ${{ startsWith(github.ref, 'refs/tags') }} + target: ${{ inputs.target }} + tags: ${{ steps.meta.outputs.tags }} + labels: ${{ steps.meta.outputs.labels }} diff --git a/.github/workflows/container.yml b/.github/workflows/container.yml new file mode 100644 index 000000000..8c4d239a6 --- /dev/null +++ b/.github/workflows/container.yml @@ -0,0 +1,56 @@ +name: Container + +on: + push: + tags: ["[0-9]+.[0-9]+.[0-9]+*"] + branches: [main] + pull_request: + branches: [main] + +jobs: + build: + runs-on: ubuntu-latest + + env: + REGISTRY: ghcr.io + NAMESPACE: ${{ github.repository_owner }} + + if: ${{ github.repository_owner == 'libretime' }} + steps: + - uses: actions/checkout@v3 + + - uses: docker/login-action@v2 + with: + registry: ${{ env.REGISTRY }} + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + + - name: Build libretime-analyzer + uses: ./.github/workflows/actions/build-container + with: + target: libretime-analyzer + images: ${{ env.REGISTRY }}/${{ env.NAMESPACE }}/libretime-analyzer + + - name: Build libretime-api + uses: ./.github/workflows/actions/build-container + with: + target: libretime-api + images: ${{ env.REGISTRY }}/${{ env.NAMESPACE }}/libretime-api + + - name: Build libretime-playout + uses: ./.github/workflows/actions/build-container + with: + target: libretime-playout + images: ${{ env.REGISTRY }}/${{ env.NAMESPACE }}/libretime-playout + + - name: Build libretime-worker + uses: ./.github/workflows/actions/build-container + with: + target: libretime-worker + images: ${{ env.REGISTRY }}/${{ env.NAMESPACE }}/libretime-worker + + - name: Build libretime-legacy + uses: ./.github/workflows/actions/build-container + with: + target: libretime-legacy + images: ${{ env.REGISTRY }}/${{ env.NAMESPACE }}/libretime-legacy