Skip to content

feat(home): show landing page to logged-in users at /?landing #29

feat(home): show landing page to logged-in users at /?landing

feat(home): show landing page to logged-in users at /?landing #29

name: Build and Push Docker Images
on:
push:
branches:
- main
env:
REGISTRY: ghcr.io
jobs:
detect-changes:
runs-on: ubuntu-latest
outputs:
matrix: ${{ steps.set-matrix.outputs.matrix }}
steps:
- uses: actions/checkout@v4
- uses: dorny/paths-filter@v3
id: filter
with:
filters: |
tracker:
- 'apps/tracker/**'
- 'packages/**'
- 'package.json'
- 'package-lock.json'
cron:
- 'apps/cron/**'
- 'packages/**'
- 'package.json'
- 'package-lock.json'
ws:
- 'apps/ws/**'
- 'packages/**'
- 'package.json'
- 'package-lock.json'
- id: set-matrix
run: |
MATRIX="[]"
if [[ "${{ steps.filter.outputs.tracker }}" == "true" ]]; then MATRIX=$(echo "$MATRIX" | jq -c '. + ["tracker"]'); fi
if [[ "${{ steps.filter.outputs.cron }}" == "true" ]]; then MATRIX=$(echo "$MATRIX" | jq -c '. + ["cron"]'); fi
if [[ "${{ steps.filter.outputs.ws }}" == "true" ]]; then MATRIX=$(echo "$MATRIX" | jq -c '. + ["ws"]'); fi
echo "matrix=$MATRIX" >> $GITHUB_OUTPUT
build-and-push:
needs: detect-changes
if: ${{ needs.detect-changes.outputs.matrix != '[]' && needs.detect-changes.outputs.matrix != '' }}
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
strategy:
matrix:
service: ${{ fromJson(needs.detect-changes.outputs.matrix) }}
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Log in to the Container registry
uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@v5
with:
images: ${{ env.REGISTRY }}/${{ github.repository }}-${{ matrix.service }}
tags: |
type=sha,format=short
type=raw,value=latest
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Build and push Docker image
uses: docker/build-push-action@v5
with:
context: .
file: ./apps/${{ matrix.service }}/Dockerfile
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
cache-from: type=gha,scope=${{ matrix.service }}
cache-to: type=gha,mode=max,scope=${{ matrix.service }}