Skip to content

Commit 536943c

Browse files
authored
Update BuildImage.yml
1 parent f19acfd commit 536943c

1 file changed

Lines changed: 15 additions & 1 deletion

File tree

.github/workflows/BuildImage.yml

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,14 +15,24 @@ jobs:
1515

1616
- name: Build image
1717
run: |
18-
docker build --no-cache -t ${{ github.sha }} .
18+
# Set version
19+
DOTNET_JSON="$(curl --retry 5 -sX GET https://raw.githubusercontent.com/dotnet/core/master/release-notes/releases-index.json)"
20+
DOTNET_VERSIONS="$(echo $DOTNET_JSON | jq -r '."releases-index"[] | select(."support-phase"=="lts") | ."latest-sdk"' | tr '\n' ' ' | head -c -1)"
21+
DOTNET_TAG="$(echo $DOTNET_VERSIONS | tr ' ' '_')"
22+
echo "DOTNET_TAG=${{ secrets.DOTNET_TAG }}" >> $GITHUB_ENV
23+
# Build image
24+
docker build --no-cache --build-arg DOTNET_VERSIONS="${DOTNET_VERSIONS}" -t ${{ github.sha }} .
1925
2026
- name: Tag image
2127
if: ${{ github.ref == format('refs/heads/{0}-{1}', env.BASEIMAGE, env.MODNAME) }}
2228
run: |
2329
docker tag ${{ github.sha }} ${ENDPOINT}:${BASEIMAGE}-${MODNAME}
30+
docker tag ${{ github.sha }} ${ENDPOINT}:${BASEIMAGE}-${MODNAME}-${{ env.DOTNET_TAG }}
31+
docker tag ${{ github.sha }} ${ENDPOINT}:${BASEIMAGE}-${MODNAME}-${{ env.DOTNET_TAG }}-${{ github.sha }}
2432
docker tag ${{ github.sha }} ${ENDPOINT}:${BASEIMAGE}-${MODNAME}-${{ github.sha }}
2533
docker tag ${{ github.sha }} ghcr.io/${ENDPOINT}:${BASEIMAGE}-${MODNAME}
34+
docker tag ${{ github.sha }} ghcr.io/${ENDPOINT}:${BASEIMAGE}-${MODNAME}-${{ env.DOTNET_TAG }}
35+
docker tag ${{ github.sha }} ghcr.io/${ENDPOINT}:${BASEIMAGE}-${MODNAME}-${{ env.DOTNET_TAG }}-${{ github.sha }}
2636
docker tag ${{ github.sha }} ghcr.io/${ENDPOINT}:${BASEIMAGE}-${MODNAME}-${{ github.sha }}
2737
2838
- name: Credential check
@@ -47,6 +57,8 @@ jobs:
4757
- name: Push tags to GitHub Container Registry
4858
if: ${{ github.ref == format('refs/heads/{0}-{1}', env.BASEIMAGE, env.MODNAME) && env.CR_USER && env.CR_PAT }}
4959
run: |
60+
docker push ghcr.io/${ENDPOINT}:${BASEIMAGE}-${MODNAME}-${{ env.DOTNET_TAG }}
61+
docker push ghcr.io/${ENDPOINT}:${BASEIMAGE}-${MODNAME}-${{ env.DOTNET_TAG }}-${{ github.sha }}
5062
docker push ghcr.io/${ENDPOINT}:${BASEIMAGE}-${MODNAME}-${{ github.sha }}
5163
docker push ghcr.io/${ENDPOINT}:${BASEIMAGE}-${MODNAME}
5264
@@ -58,5 +70,7 @@ jobs:
5870
- name: Push tags to DockerHub
5971
if: ${{ github.ref == format('refs/heads/{0}-{1}', env.BASEIMAGE, env.MODNAME) && env.DOCKERUSER && env.DOCKERPASS }}
6072
run: |
73+
docker push ${ENDPOINT}:${BASEIMAGE}-${MODNAME}-${{ env.DOTNET_TAG }}
74+
docker push ${ENDPOINT}:${BASEIMAGE}-${MODNAME}-${{ env.DOTNET_TAG }}-${{ github.sha }}
6175
docker push ${ENDPOINT}:${BASEIMAGE}-${MODNAME}-${{ github.sha }}
6276
docker push ${ENDPOINT}:${BASEIMAGE}-${MODNAME}

0 commit comments

Comments
 (0)