File: docker.yaml

package info (click to toggle)
sphinx-needs 5.1.0%2Bdfsg-6
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 12,108 kB
  • sloc: python: 21,148; javascript: 187; makefile: 95; sh: 29; xml: 10
file content (77 lines) | stat: -rw-r--r-- 2,396 bytes parent folder | download
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
73
74
75
76
77
name: Docker-Image

on:
  # Allow manual trigger
  workflow_dispatch:
    inputs:
      # Ask if docker deployment needed when manually triggered
      deploy:
        description: 'Deploy Docker Image (y/n)?'
        required: true
        default: 'n'
  push:
    tags:
      - '*.*.*'
  pull_request:
    paths: ['docker/**']

env:
  NEEDS_VERSION: 5.1.0
  DEPLOY_IMAGE: ${{ github.event_name != 'pull_request' }}

jobs:
  build:
    strategy:
      fail-fast: ${{ github.event_name != 'pull_request' }}
      matrix:
        base-image: ["sphinxdoc/sphinx:latest", "sphinxdoc/sphinx-latexpdf:latest"]
        image: ["sphinxneeds", "sphinxneeds-latexpdf"]
        exclude:
        - base-image: "sphinxdoc/sphinx:latest"
          image: "sphinxneeds-latexpdf"
        - base-image: "sphinxdoc/sphinx-latexpdf:latest"
          image: "sphinxneeds"
    name: "Image: ${{ matrix.image }} | Baseimage: ${{ matrix.base-image }}"
    runs-on: ubuntu-latest
    steps:
      # Checks-out your repository under $GITHUB_WORKSPACE
      - name: Checkout 🛎️
        uses: actions/checkout@v4
      -
        name: Set up Docker Build 🐋
        uses: docker/setup-buildx-action@v3
      -
        name: Extract metadata (tags, labels) for Docker
        id: meta
        uses: docker/metadata-action@v5
        with:
          images: |
            ${{ secrets.DOCKERHUB_USERNAME }}/${{ matrix.image }}
          flavor: |
            latest=true
          tags: |
            type=pep440,pattern={{version}}

      - name: Check if deployment manually disabled
        if: github.event.inputs.deploy == 'n'
        run: |
          echo "DEPLOY_IMAGE=false" >> "$GITHUB_ENV"

      - name: Login to Docker Hub Docker Registry 🐸
        uses: docker/login-action@v3
        with:
          username: ${{ secrets.DOCKERHUB_USERNAME }}
          password: ${{ secrets.DOCKERHUB_TOKEN }}

      - name: Build and push html image to Doker Hub Docker Registry 🐳
        id: docker_build
        uses: docker/build-push-action@v5
        with:
          push: ${{ env.DEPLOY_IMAGE == 'true' }}
          file: docker/Dockerfile
          platforms: linux/amd64,linux/arm64
          build-args: |
            NEEDS_VERSION=${{ env.NEEDS_VERSION }}
            BASE_IMAGE=${{ matrix.base-image }}
          tags: ${{ steps.meta.outputs.tags }}
          labels: ${{ steps.meta.outputs.labels }}