@@ -46,56 +46,21 @@ jobs:
4646 runs-on : ubuntu-latest
4747 needs : [info]
4848 if : github.event_name == 'release'
49- env :
50- DOCKER_SERVER : docker.io
51- DOCKER_USERNAME : ${{ secrets.DOCKER_USERNAME }}
52- DOCKER_PASSWORD : ${{ secrets.DOCKER_PASSWORD }}
5349 steps :
5450 - name : Checkout commit
5551 uses : actions/checkout@v2
56- - name : Install python
57- uses : actions/setup-python@v2
52+ - name : Login to DockerHub
53+ 5854 with :
59- python-version : ' 3.9'
55+ username : ${{ secrets.DOCKER_USERNAME }}
56+ password : ${{ secrets.DOCKER_PASSWORD }}
6057 - name : Build release image
61- run : |
62- export PACKAGE="${{ needs.info.outputs.name }}==${{ needs.info.outputs.version }}"
63- docker build -t neuromation/${{ needs.info.outputs.name }}:latest .
64- - name : Push release release image
65- id : push
6658 run : |
6759 export IMAGE=neuromation/${{ needs.info.outputs.name }}
6860 export TAG=${{ needs.info.outputs.version }}
6961
70- echo "::set-output name=image::$IMAGE"
71- echo "::set-output name=tag::$TAG"
72-
73- docker login $DOCKER_SERVER --username $DOCKER_USERNAME --password $DOCKER_PASSWORD
74- docker tag $IMAGE:latest $IMAGE:$TAG
75- docker push $IMAGE:$TAG
76- # Push latest if it's not an alpha release:
77- # not alpha: TAG="20.9.29"
78- # alpha: TAG="20.9.29a1"
79- if [[ ! "$TAG" =~ ^.*a[0-9]*$ ]]; then
80- docker $IMAGE:latest
81- fi
82- - name : Wait until image becomes available on DockerHub
83- timeout-minutes : 10
62+ docker build -t neuromation/${{ needs.info.outputs.name }}:latest -t $IMAGE:$TAG .
63+ - name : Push release release image
64+ id : push
8465 run : |
85- export IMAGE=${{ steps.push.outputs.image }}
86- export TAG=${{ steps.push.outputs.tag }}
87-
88- docker_tag_exists () {
89- CT="Content-Type: application/json"
90- U=$DOCKER_USERNAME
91- P=$DOCKER_PASSWORD
92- URL=https://hub.docker.com
93- TOKEN=$(curl -s -H "$CT" -X POST -d '{"username": "'$U'", "password": "'$P'"}' $URL/v2/users/login/ | jq -r .token)
94- curl --silent -f --head -lL $URL/v2/repositories/$1/tags/$2/ > /dev/null
95- }
96-
97- until docker_tag_exists $IMAGE $TAG
98- do
99- echo "Waiting for the dockerhub image $IMAGE:$TAG ..."
100- sleep 1
101- done
66+ docker push neuromation/${{ needs.info.outputs.name }} --all-tags
0 commit comments