diff --git a/.github/workflows/docker.yaml b/.github/workflows/docker.yaml index cd375118b..42faf2298 100644 --- a/.github/workflows/docker.yaml +++ b/.github/workflows/docker.yaml @@ -12,12 +12,17 @@ on: push: tags: - '*.*.*' + pull_request: + paths: ['docker/**'] + env: NEEDS_VERSION: 2.0.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"] @@ -46,30 +51,27 @@ jobs: latest=true tags: | type=pep440,pattern={{version}} - - - # Check if deployment is needed (if no manual trigger was done, defaults to 'y') - name: Check if deployment is needed - id: deploycheck + + - name: Check if deployment manually disabled + if: github.event.inputs.deploy == 'n' run: | - DEPLOY_CHECK=${{ github.event.inputs.deploy }} - echo "::set-output name=value::${DEPLOY_CHECK:-"y"}" - - - # Login to Docker Hub Docker Registry for deployment - name: Login to Docker Hub Docker Registry 🐸 + 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 🐳 + + - name: Build and push html image to Doker Hub Docker Registry 🐳 id: docker_build uses: docker/build-push-action@v5 with: - push: ${{ github.event_name != 'pull_request' && steps.deploycheck.outputs.value == 'y' }} + 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 }}} + labels: ${{ steps.meta.outputs.labels }} diff --git a/docker/Dockerfile b/docker/Dockerfile index 36078bf25..1066680b3 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -14,7 +14,6 @@ ARG DEBIAN_FRONTEND=noninteractive # Install apt & make RUN \ - sed -i 's/# \(.*multiverse$\)/\1/g' /etc/apt/sources.list && \ apt-get update && \ apt-get upgrade -y && \ apt-get install -y --no-install-recommends sudo @@ -48,11 +47,11 @@ RUN pip3 install --no-cache-dir \ # Install Sphinx-Needs RUN \ if [ -n "$NEEDS_VERSION" ] && [ "$NEEDS_VERSION" = "pre-release" ]; then \ - pip3 install --no-cache-dir git+https://github.com/useblocks/sphinx-needs; \ + pip3 install --no-cache-dir "sphinx-needs[plotting] @ git+https://github.com/useblocks/sphinx-needs"; \ elif [ -n "$NEEDS_VERSION" ]; then \ - pip3 install --no-cache-dir git+https://github.com/useblocks/sphinx-needs@$NEEDS_VERSION; \ + pip3 install --no-cache-dir "sphinx-needs[plotting] @ git+https://github.com/useblocks/sphinx-needs@$NEEDS_VERSION"; \ else \ - pip3 install --no-cache-dir sphinx-needs; \ + pip3 install --no-cache-dir sphinx-needs[plotting]; \ fi ## Clean up