diff --git a/.github/workflows/docker-build.yml b/.github/workflows/docker-build.yml index 18be5bf..e0e5005 100644 --- a/.github/workflows/docker-build.yml +++ b/.github/workflows/docker-build.yml @@ -77,11 +77,11 @@ jobs: if [[ ${{ matrix.build.latest }} == "true" ]]; then echo "Marking latest" # GHCR.io - TAGS="${img_path}:${base_tag}-${KOHYA_BUILD_REF}, ${img_path}:${base_tag}, ${img_path}:latest, ${img_path}:latest-cuda" + TAGS="${img_path_ghcr}:${base_tag}-${KOHYA_BUILD_REF}, ${img_path_ghcr}:${base_tag}, ${img_path_ghcr}:latest, ${img_path_ghcr}:latest-cuda" # Docker.io Tags TAGS="${TAGS}, ${img_path_dhub}:${KOHYA_BUILD_REF}, ${img_path_dhub}:latest" else - TAGS="${img_path}:${base_tag}-${KOHYA_BUILD_REF}, ${img_path_dhub}:${KOHYA_BUILD_REF}" + TAGS="${img_path_ghcr}:${base_tag}-${KOHYA_BUILD_REF}, ${img_path_dhub}:${KOHYA_BUILD_REF}" fi echo "TAGS=${TAGS}" >> ${GITHUB_ENV} - @@ -120,19 +120,26 @@ jobs: - name: Env Setter run: | - echo "PACKAGE_NAME=${GITHUB_REPOSITORY,,}" >> ${GITHUB_ENV} + REPO=${GITHUB_REPOSITORY,,} + echo "REPO_NAMESPACE=${REPO%%/*}" >> ${GITHUB_ENV} + echo "REPO_NAME=${REPO#*/}" >> ${GITHUB_ENV} - name: Checkout uses: actions/checkout@v3 - name: Permissions fixes run: | - reponame="$(basename ${GITHUB_REPOSITORY})" - target="${HOME}/work/${reponame}/${reponame}/build/COPY*" + target="${HOME}/work/${{ env.REPO_NAME }}/${{ env.REPO_NAME }}/build/COPY*" chmod -R ug+rwX ${target} + - + name: Login to DockerHub + uses: docker/login-action@v3 + with: + username: ${{ vars.DOCKERHUB_USER }} + password: ${{ secrets.DOCKERHUB_TOKEN }} - name: Login to GitHub Container Registry - uses: docker/login-action@v2 + uses: docker/login-action@v3 with: registry: ghcr.io username: ${{ github.actor }} @@ -140,7 +147,8 @@ jobs: - name: Set tags run: | - img_path="ghcr.io/${{ env.PACKAGE_NAME }}" + img_path_ghcr="ghcr.io/${{ env.REPO_NAMESPACE }}/${{ env.REPO_NAME }}" + img_path_dhub="${{ vars.DOCKERHUB_USER }}/${{ env.REPO_NAME }}-rocm" if [[ -z '${{ matrix.build.kohya }}' ]]; then KOHYA_BUILD_REF="$(curl -s https://api.github.com/repos/bmaltais/kohya_ss/tags | jq -r '.[0].name')" @@ -155,11 +163,11 @@ jobs: if [[ ${{ matrix.build.latest }} == "true" ]]; then echo "Marking latest" # GHCR.io Tags - TAGS="${img_path}:${base_tag}-${KOHYA_BUILD_REF}, ${img_path}:${base_tag}, ${img_path}:latest-rocm" + TAGS="${img_path_ghcr}:${base_tag}-${KOHYA_BUILD_REF}, ${img_path_ghcr}:${base_tag}, ${img_path_ghcr}:latest-rocm" # Docker.io Tags TAGS="${TAGS}, ${img_path_dhub}:${KOHYA_BUILD_REF}, ${img_path_dhub}:latest" else - TAGS="${img_path}:${base_tag}-${KOHYA_BUILD_REF}, ${img_path_dhub}:${KOHYA_BUILD_REF}" + TAGS="${img_path_ghcr}:${base_tag}-${KOHYA_BUILD_REF}, ${img_path_dhub}:${KOHYA_BUILD_REF}" fi echo "TAGS=${TAGS}" >> ${GITHUB_ENV} -