aboutsummaryrefslogblamecommitdiffstatshomepage
path: root/.github/workflows/ci.yml
blob: 1fdc0a6d3b00ce0e1693f6856ee36bc2deee007e (plain) (tree)
1
2
3
4
5
6
7
8
9
        






                    
          


                                     
                          
                                           

                      
                                 
                         
                                         
                                  
                                           
                                 
                                    


                                                       








                                                                            
                                             
                                         


                                                  

                                                               
                                                                                
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'