Skip to content

Commit

Permalink
Update push script to use ghcr.io (#106)
Browse files Browse the repository at this point in the history
  • Loading branch information
tjamet authored Sep 22, 2023
1 parent b8b65dd commit f373fd3
Showing 1 changed file with 20 additions and 5 deletions.
25 changes: 20 additions & 5 deletions .github/workflows/push.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,24 @@ jobs:
runs-on: ubuntu-latest
steps:
- run: echo success

login:
runs-on: ubuntu-latest
steps:
- name: Login to Docker Hub
uses: docker/login-action@v3
with:
username: whalebrewci
password: ${{ secrets.DOCKER_HUB_PASSWORD }}
- name: Login to Docker Hub
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
docker-build:
needs:
- login
runs-on: ubuntu-latest
strategy:
fail-fast: false
Expand Down Expand Up @@ -120,16 +137,14 @@ jobs:
fi
if: steps.is-modified.outputs.modified == 'true' || (github.event_name == 'push' && github.event.ref == 'refs/heads/re-builld-all')
- run: |
echo ${{ secrets.DOCKER_HUB_PASSWORD }} | base64 -d | docker login --password-stdin -u whalebrewci
echo ${{ github.token }} | docker login --password-stdin -u ${{ github.actor }} docker.pkg.github.com
docker tag ${{ matrix.image }} ${{ github.event.repository.owner.name}}/${{ matrix.image }}
docker tag ${{ matrix.image }} docker.pkg.github.com/${{ github.event.repository.owner.name }}/${{ github.event.repository.name }}/${{ matrix.image }}
docker tag ${{ matrix.image }} ghcr.io/${{ github.event.repository.owner.name }}/${{ github.event.repository.name }}/${{ matrix.image }}
if [ -e "${{ matrix.image }}/tags.yaml" ]; then
for tag in $(cat "${{ matrix.image }}/tags.yaml" | docker run --rm -i whalebrew/yq -r '.versions[]'); do
docker tag ${{ matrix.image }}:${tag} ${{ github.event.repository.owner.name}}/${{ matrix.image }}:${tag}
docker tag ${{ matrix.image }}:${tag} docker.pkg.github.com/${{ github.event.repository.owner.name }}/${{ github.event.repository.name }}/${{ matrix.image }}:${tag}
docker tag ${{ matrix.image }}:${tag} ghcr.io/${{ github.event.repository.owner.name }}/${{ github.event.repository.name }}/${{ matrix.image }}:${tag}
docker push ${{ github.event.repository.owner.name}}/${{ matrix.image }}:${tag}
docker push docker.pkg.github.com/${{ github.event.repository.owner.name}}/${{ github.event.repository.name }}/${{ matrix.image }}:${tag}
docker push ghcr.io/${{ github.event.repository.owner.name}}/${{ github.event.repository.name }}/${{ matrix.image }}:${tag}
done
fi
Expand Down

0 comments on commit f373fd3

Please sign in to comment.