diff --git a/.github/workflows/image-template.yml b/.github/workflows/image-template.yml index e946e35..1c1a68f 100644 --- a/.github/workflows/image-template.yml +++ b/.github/workflows/image-template.yml @@ -55,25 +55,26 @@ on: default: false env: - # Use docker.io for Docker Hub if empty REGISTRY: ${{ github.event.inputs.registry }} + USERNAME: | + if: ${{ github.event.inputs.registry == 'ghcr.io' }} ${{ github.actor }} + if: ${{ github.event.inputs.registry == 'docker.io' }} ${{ secrets.DOCKERHUB_USERNAME }} + PASSWORD: | + if: ${{ github.event.inputs.registry == 'ghcr.io' }} ${{ secrets.GITHUB_TOKEN }} + if: ${{ github.event.inputs.registry == 'docker.io' }} ${{ secrets.DOCKERHUB_TOKEN }} # name of image IMAGE: privoxy - # github.repository as / + # repository as / IMAGE_NAME: ${{ github.event.inputs.username }}/privoxy # Build args CONTEXT: . DISTRO: ${{ github.event.inputs.distro }} RELEASE: ${{ github.event.inputs.release }} BUILD_ARGS: | - if: ${{ github.event.inputs.distro == 'alpine' }} - "ALPINE_VER=${{ vars.ALPINE_VER }}" - if: ${{ github.event.inputs.distro == 'ubuntu' }} - "UBUNTU_VER=${{ vars.UBUNTU_VER }}" - if: ${{ github.event.inputs.release == 'stable' }} - "PRIVOXY_VER=3.0.34" - if: ${{ github.event.inputs.release == 'edge' }} - "PRIVOXY_VER=3.0.35" + if: ${{ github.event.inputs.distro == 'alpine' }} "ALPINE_VER=${{ vars.ALPINE_VER }}" + if: ${{ github.event.inputs.distro == 'ubuntu' }} "UBUNTU_VER=${{ vars.UBUNTU_VER }}" + if: ${{ github.event.inputs.release == 'stable' }} "PRIVOXY_VER=3.0.34" + if: ${{ github.event.inputs.release == 'edge' }} "PRIVOXY_VER=3.0.35" jobs: build: @@ -107,16 +108,8 @@ jobs: uses: docker/login-action@v2 with: registry: ${{ env.REGISTRY }} - username: | - if: ${{ env.REGISTRY == 'ghcr.io' }} - ${{ github.actor }} - if: ${{ env.REGISTRY == 'docker.io' }} - ${{ secrets.DOCKERHUB_USERNAME }} - password: | - if: ${{ env.REGISTRY == 'ghcr.io' }} - ${{ secrets.GITHUB_TOKEN }} - if: ${{ env.REGISTRY == 'docker.io' }} - ${{ secrets.DOCKERHUB_TOKEN }} + username: ${{ env.USERNAME }} + password: ${{ env.PASSWORD }} # Extract metadata (tags, labels) for Docker # https://github.com/docker/metadata-action - name: Extract Docker metadata