aboutsummaryrefslogtreecommitdiffstats
path: root/.github/workflows/publish.yaml
blob: 7f5b11fed620fd0dd7e34f109a8af147dad7cfe9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
permissions:
  contents: read
  packages: write
on:
  push:
    # branches: [master]
    tags: [v*]
  workflow_dispatch:
    inputs:
      processors:
        description: "List of processors"
        type: string
        required: false
        default: "['pseudonyms', 'warden', 'configuration', 'router', 'rule-executor', 'aggregator', 'typologies']"
      apiDoc:
        description: 'API Documentation'
        required: false
        type: choice
        options:
        - scalar
        - swagger
        - redoc
        - rapidoc

concurrency:
  group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
  cancel-in-progress: true

name: publish

jobs:
  docker:
    runs-on: ubuntu-latest
    strategy:
      matrix:
        crate: ${{ fromJSON(github.event.inputs.processors || '["pseudonyms", "warden", "configuration", "router", "rule-executor", "aggregator", "typologies"]') }}
    steps:
      - uses: actions/checkout@v5
        with:
          submodules: true

      - name: Login to Docker Hub
        uses: docker/login-action@v3
        with:
          registry: ghcr.io
          username: ${{ github.actor }}
          password: ${{ secrets.GITHUB_TOKEN }}

      - name: Set up QEMU
        uses: docker/setup-qemu-action@v3

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

      - name: Extract metadata
        id: meta
        uses: docker/metadata-action@v5
        with:
          images: ghcr.io/${{ github.actor }}/warden-${{ matrix.crate }}${{ (matrix.crate == 'warden' || matrix.crate == 'configuration') && format('-{0}', github.event.inputs.apiDoc || 'scalar') || '' }}

      - name: Build and push
        uses: docker/build-push-action@v6
        with:
          sbom: true
          push: true
          context: .
          file: crates/${{ matrix.crate }}/Dockerfile
          provenance: mode=max
          tags: ${{ steps.meta.outputs.tags }}
          labels: ${{ steps.meta.outputs.labels }}
          build-args: |
            FEATURES=${{ github.event.inputs.apiDoc || 'scalar' }}