aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/.github/workflows/ci.yml
blob: 1fdc0a6d3b00ce0e1693f6856ee36bc2deee007e (plain) (blame)
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
name: CI

on:
  push:
  pull_request:
  workflow_dispatch:

jobs:
  publish:
    strategy:
      matrix:
        project: [dump1090, fr24feed]
    runs-on: ubuntu-latest
    name: 'Publish / ${{ matrix.project }}'
    steps:
      - name: Checkout
        uses: actions/checkout@v4
      - name: Set up QEMU
        uses: docker/setup-qemu-action@v3
      - name: Set up Docker Buildx
        uses: docker/setup-buildx-action@v3
      - name: Login to Docker Hub
        uses: docker/login-action@v3
        with:
          username: '${{ secrets.DOCKERHUB_USERNAME }}'
          password: '${{ secrets.DOCKERHUB_TOKEN }}'
      - id: platforms
        name: Which platforms?
        # Building for all platforms for every commit is too time-consuming.
        run: |
          if [ '${{ github.ref }}' = 'refs/heads/master' ]; then
              echo 'platforms=i386,amd64,arm64' >> "$GITHUB_OUTPUT"
          else
              echo 'platforms=amd64' >> "$GITHUB_OUTPUT"
          fi
      - name: 'Publish ${{ matrix.project }}'
        uses: docker/build-push-action@v5
        with:
          context: '${{ matrix.project }}'
          file: '${{ matrix.project }}/Dockerfile'
          platforms: '${{ steps.platforms.outputs.platforms }}'
          push: ${{ github.ref == 'refs/heads/master' }}
          tags: '${{ secrets.DOCKERHUB_USERNAME }}/${{ matrix.project }}:latest'