Updated build script

This commit is contained in:
Alexey Pustovalov 2021-10-08 15:42:43 +02:00
parent 7324b217bf
commit 521bf35c9e

View File

@ -37,6 +37,7 @@ jobs:
- name: Check build.json file - name: Check build.json file
id: build_exists id: build_exists
run: | run: |
docker build --help
if (-not(Test-Path -Path "./build.json" -PathType Leaf)) { if (-not(Test-Path -Path "./build.json" -PathType Leaf)) {
throw "::error::File build.json is missing" throw "::error::File build.json is missing"
} }
@ -96,13 +97,12 @@ jobs:
- name: Build ${{ env.BASE_BUILD_NAME }}/${{ matrix.build }}-${{ matrix.os }} and push - name: Build ${{ env.BASE_BUILD_NAME }}/${{ matrix.build }}-${{ matrix.os }} and push
id: docker_build id: docker_build
run: | run: |
$tags=$(echo "${{ steps.meta.outputs.tags}}" | jq --raw-input . | jq --slurp . | jq -r '. | map("""-t """ + .) | join(""" """)') $tags_array=$( "${{ steps.meta.outputs.tags}}".Split("`r`n") | Foreach-Object { "--tag=$_" } )
echo $tags $tags=$( $tags_array - Join ' ' )
docker login -u ${{ secrets.DOCKER_USERNAME }} -p ${{ secrets.DOCKER_PASSWORD }} docker login -u ${{ secrets.DOCKER_USERNAME }} -p ${{ secrets.DOCKER_PASSWORD }}
echo "docker build --file=.\Dockerfiles\${{ env.BASE_BUILD_NAME }}\windows\Dockerfile.${{ matrix.build }} $tags .\Dockerfiles\${{ env.BASE_BUILD_NAME }}\windows\" echo "docker build --file=.\Dockerfiles\${{ env.BASE_BUILD_NAME }}\windows\Dockerfile.${{ matrix.build }} $tags .\Dockerfiles\${{ env.BASE_BUILD_NAME }}\windows\"
docker build --file=.\Dockerfiles\${{ env.BASE_BUILD_NAME }}\windows\Dockerfile.${{ matrix.build }} $tags .\Dockerfiles\${{ env.BASE_BUILD_NAME }}\windows\ docker build --file=.\Dockerfiles\${{ env.BASE_BUILD_NAME }}\windows\Dockerfile.${{ matrix.build }} $tags .\Dockerfiles\${{ env.BASE_BUILD_NAME }}\windows\
$main_tag=$(echo "${{ steps.meta.outputs.tags}}" | jq --raw-input . | jq --slurp . | jq -r '.[0]') docker push image push --all-tags $tags_array[0]
docker push image push --all-tags $main_tag
docker logout docker logout
- name: Image digest - name: Image digest
@ -112,7 +112,8 @@ jobs:
echo "$digest" > ${{ env.BASE_BUILD_NAME }}_${{ matrix.os }}_${{ matrix.build }} echo "$digest" > ${{ env.BASE_BUILD_NAME }}_${{ matrix.os }}_${{ matrix.build }}
- name: Upload SHA256 tag - name: Upload SHA256 tag
uses: actions/upload-artifact@v2.2.4 uses: actions/upload-ar
tifact@v2.2.4
with: with:
name: ${{ env.BASE_BUILD_NAME }}_${{ matrix.os }}_${{ matrix.build }} name: ${{ env.BASE_BUILD_NAME }}_${{ matrix.os }}_${{ matrix.build }}
path: ${{ env.BASE_BUILD_NAME }}_${{ matrix.os }}_${{ matrix.build }} path: ${{ env.BASE_BUILD_NAME }}_${{ matrix.os }}_${{ matrix.build }}