Skip to content

Commit

Permalink
docker: Still push to Docker Hub and to XboxDev group
Browse files Browse the repository at this point in the history
  • Loading branch information
sharkwouter committed Jul 30, 2023
1 parent ede567c commit a82c2c0
Showing 1 changed file with 38 additions and 1 deletion.
39 changes: 38 additions & 1 deletion .github/workflows/build_docker_image.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,45 @@ jobs:
cd ..
done
- name: Push container if on master branch
if: ${{ github.ref == 'refs/heads/master' }}
if: github.ref == 'refs/heads/master'
run: |
docker login -u "${{ github.actor }}" -p "${{ secrets.GITHUB_TOKEN }}" ghcr.io
docker tag ${{ matrix.tag }} ghcr.io/${{ github.repository }}:${{ matrix.tag }}
docker push ghcr.io/${{ github.repository }}:${{ matrix.tag }}
xboxdev_containers:
name: Push Official Containers
if: github.repository_owner == 'XboxDev' && github.ref == 'refs/heads/master'
needs: [main]
runs-on: ubuntu-latest
strategy:
matrix:
tag: [latest, debug, lto]
steps:
- name: Pull container
run: |
docker login -u "${{ github.actor }}" -p "${{ secrets.GITHUB_TOKEN }}" ghcr.io
docker pull ghcr.io/${{ github.repository }}:${{ matrix.tag }}
- name: Push to XboxDev group
run: |
if [ "${{ matrix.tag }}" == "latest" ]; then
TARGET="ghcr.io/${{ github.repository_owner }}/nxdk"
else
TARGET="ghcr.io/${{ github.repository_owner }}/nxdk-${{ matrix.tag }}"
fi
docker tag ghcr.io/${{ github.repository }}:${{ matrix.tag }} ${TARGET}:latest
docker tag ghcr.io/${{ github.repository }}:${{ matrix.tag }} ${TARGET}:git-${GITHUB_SHA::8}
docker push ${TARGET}:latest
docker push ${TARGET}:git-${GITHUB_SHA::8}
- name: Push to Docker Hub
run: |
docker login -u "${{ secrets.DOCKERHUB_USERNAME }}" -p "${{ secrets.DOCKERHUB_TOKEN }}"
if [ "${{ matrix.tag }}" == "latest" ]; then
TARGET="xboxdev/nxdk"
else
TARGET="xboxdev/nxdk-${{ matrix.tag }}"
fi
docker tag ghcr.io/${{ github.repository }}:${{ matrix.tag }} ${TARGET}:latest
docker tag ghcr.io/${{ github.repository }}:${{ matrix.tag }} ${TARGET}:git-${GITHUB_SHA::8}
docker push ${TARGET}:latest
docker push ${TARGET}:git-${GITHUB_SHA::8}

0 comments on commit a82c2c0

Please sign in to comment.