@@ -26,47 +26,52 @@ jobs:
2626 name : Build docker image and push if needed
2727 runs-on : ubuntu-latest
2828 steps :
29+ - name : Checkout
30+ uses : actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
31+
2932 # Depending on the branch/tag, set CLONE_BRANCH_OR_TAG variable (used in the Dockerfile
30- # as a build arg) and TAG_NAME (used when tagging the image).
33+ # as a build arg) and DOCKER_TAGS (used when tagging the image).
3134 #
3235 # The following 3 steps cover the alternatives (tag, release branch, master branch):
3336 - name : Set variables (tags)
3437 if : ${{ github.ref_type == 'tag' }}
3538 run : |
3639 echo "CLONE_BRANCH_OR_TAG=$GITHUB_REF_NAME" >> $GITHUB_ENV
37- echo "TAG_NAME= $GITHUB_REF_NAME" >> $GITHUB_ENV
40+ echo "DOCKER_TAGS=${{ env.DOCKERHUB_REPO }}: $GITHUB_REF_NAME" >> $GITHUB_ENV
3841 echo "URL=${{ github.server_url }}/${{ github.repository }}.git" >> $GITHUB_ENV
3942
4043 - name : Set variables (release branches)
4144 if : ${{ github.ref_type == 'branch' && startsWith(github.ref_name, 'release/') }}
4245 run : |
4346 echo "CLONE_BRANCH_OR_TAG=$GITHUB_REF_NAME" >> $GITHUB_ENV
44- echo "TAG_NAME= release-${GITHUB_REF_NAME##release/}" >> $GITHUB_ENV
47+ echo "DOCKER_TAGS=${{ env.DOCKERHUB_REPO }}: release-${GITHUB_REF_NAME##release/}" >> $GITHUB_ENV
4548 echo "URL=${{ github.server_url }}/${{ github.repository }}.git" >> $GITHUB_ENV
4649
4750 - name : Set variables (main branch)
4851 if : ${{ github.ref_type == 'branch' && github.ref_name == 'master' }}
4952 run : |
53+ source ./tools/config.sh
5054 echo "CLONE_BRANCH_OR_TAG=master" >> $GITHUB_ENV
51- echo "TAG_NAME=latest" >> $GITHUB_ENV
55+ echo "DOCKER_TAGS<<EOF" >> $GITHUB_ENV
56+ echo "${{ env.DOCKERHUB_REPO }}:latest" >> $GITHUB_ENV
57+ echo "${{ env.DOCKERHUB_REPO }}:release-${IDF_BRANCH##release/}" >> $GITHUB_ENV
58+ echo "EOF" >> $GITHUB_ENV
5259 echo "URL=${{ github.server_url }}/${{ github.repository }}.git" >> $GITHUB_ENV
5360
5461 - name : Set variables (pull requests)
5562 if : ${{ github.event_name == 'pull_request' }}
5663 run : |
5764 echo "CLONE_BRANCH_OR_TAG=${{ github.event.pull_request.head.ref }}" >> $GITHUB_ENV
58- echo "TAG_NAME= PR_${{ github.event.number }}" >> $GITHUB_ENV
65+ echo "DOCKER_TAGS=${{ env.DOCKERHUB_REPO }}: PR_${{ github.event.number }}" >> $GITHUB_ENV
5966 echo "URL=${{ github.server_url }}/${{ github.event.pull_request.head.repo.full_name }}.git" >> $GITHUB_ENV
6067
6168 # Display the variables set above, just in case.
6269 - name : Check variables
6370 run : |
6471 echo "CLONE_BRANCH_OR_TAG: $CLONE_BRANCH_OR_TAG"
65- echo "TAG_NAME: $TAG_NAME"
6672 echo "URL: $URL"
67-
68- - name : Checkout
69- uses : actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
73+ echo "DOCKER_TAGS:"
74+ echo "$DOCKER_TAGS"
7075
7176 - name : Login to Docker Hub
7277 if : ${{ github.event_name == 'push' }}
8691 with :
8792 context : tools/docker
8893 push : ${{ github.event_name == 'push' }}
89- tags : ${{ env.DOCKERHUB_REPO }}:${{ env.TAG_NAME }}
94+ tags : |
95+ ${{ env.DOCKER_TAGS }}
9096 platforms : ${{ env.BUILD_PLATFORMS }}
9197 build-args : |
9298 LIBBUILDER_CLONE_URL=${{ env.URL }}
0 commit comments