Updated build script

This commit is contained in:
Alexey Pustovalov 2021-10-09 10:12:02 +02:00
parent 9534df088a
commit 59c4acf189
3 changed files with 39 additions and 16 deletions

View File

@ -48,14 +48,14 @@ jobs:
- name: Prepare Operating System list
id: os
run: |
os_list=$(jq -r '.os | keys | [ .[] | tostring ] | @json' "./build.json")
os_list=$(jq -r '.["os-linux"] | keys | [ .[] | tostring ] | @json' "./build.json")
echo "::set-output name=list::$os_list"
- name: Prepare Platform list
id: platform_list
run: |
platform_list=$(jq -r '.os | tostring | @json' "./build.json")
platform_list=$(jq -r '.["os-linux"] | tostring | @json' "./build.json")
echo "::set-output name=list::$platform_list"
@ -108,7 +108,7 @@ jobs:
- name: Prepare Platform list
id: platform
run: |
platform_list=$(jq -r '.os.${{ matrix.os }} | join(",")' "./build.json")
platform_list=$(jq -r '.["os-linux"].${{ matrix.os }} | join(",")' "./build.json")
echo ::set-output name=list::$platform_list
@ -178,7 +178,7 @@ jobs:
- name: Prepare Platform list
id: platform
run: |
platform_list=$(jq -r '.os.${{ matrix.os }} | join(",")' "./build.json")
platform_list=$(jq -r '.["os-linux"].${{ matrix.os }} | join(",")' "./build.json")
echo ::set-output name=list::$platform_list
@ -266,7 +266,7 @@ jobs:
if [ "${{ matrix.os }}" == "alpine" ] && [ "${{ matrix.build }}" == "web-service" ]; then
platform_list="linux/amd64,linux/arm64"
else
platform_list=$(jq -r '.os.${{ matrix.os }} | join(",")' "./build.json")
platform_list=$(jq -r '.["os-linux"].${{ matrix.os }} | join(",")' "./build.json")
fi
echo ::set-output name=list::$platform_list

View File

@ -47,7 +47,7 @@ jobs:
- name: Prepare Operating System list
id: os
run: |
$os_list='["ltsc2022"]'
os_list=$(jq -r '.["os-windows"] | keys | [ .[] | tostring ] | @json' ".\build.json")
echo "::set-output name=list::$os_list"
@ -74,7 +74,7 @@ jobs:
os: ${{ fromJson(needs.init_build.outputs.os) }}
component: ${{ fromJson(needs.init_build.outputs.components) }}
runs-on: windows-2022
runs-on: ${{ matrix.os }}
steps:
- name: Checkout repository
uses: actions/checkout@v2.3.4
@ -86,14 +86,20 @@ jobs:
docker login -u ${{ secrets.DOCKER_USERNAME }} -p ${{ secrets.DOCKER_PASSWORD }}
if (-not $?) {throw "Failed"}
- name: Base OS tag
id: base_os_tag
run: |
$os_tag=$(Get-Content -Path .\build.json | ConvertFrom-Json).'os-windows'.'${{ matrix.os }}'
echo "::set-output name=os_tag::$os_tag"
- name: Generate tags
id: meta
uses: docker/metadata-action@v3
with:
images: ${{ env.DOCKER_REPOSITORY }}/${{ env.IMAGE_PREFIX }}${{ env.BASE_BUILD_NAME }}
tags: |
type=ref,event=branch,prefix=${{ matrix.component }}-${{ matrix.os }}-
type=ref,event=branch,suffix=-${{ matrix.os }},prefix=${{ matrix.component }}-
type=ref,event=branch,prefix=${{ matrix.component }}-${{ steps.base_os_tag.outputs.os_tag }}-
type=ref,event=branch,suffix=-${{ steps.base_os_tag.outputs.os_tag }},prefix=${{ matrix.component }}-
flavor: |
latest=false
@ -162,7 +168,7 @@ jobs:
os: ${{ fromJson(needs.init_build.outputs.os) }}
component: ${{ fromJson(needs.init_build.outputs.components) }}
runs-on: windows-2022
runs-on: ${{ matrix.os }}
steps:
- name: Checkout repository
uses: actions/checkout@v2.3.4
@ -172,14 +178,20 @@ jobs:
docker login -u ${{ secrets.DOCKER_USERNAME }} -p ${{ secrets.DOCKER_PASSWORD }}
if (-not $?) {throw "Failed"}
- name: Base OS tag
id: base_os_tag
run: |
$os_tag=$(Get-Content -Path .\build.json | ConvertFrom-Json).'os-windows'.'${{ matrix.os }}'
echo "::set-output name=os_tag::$os_tag"
- name: Generate tags
id: meta
uses: docker/metadata-action@v3
with:
images: ${{ env.DOCKER_REPOSITORY }}/${{ env.IMAGE_PREFIX }}${{ env.COMPONENT_BASE_BUILD_NAME }}
tags: |
type=ref,event=branch,prefix=${{ matrix.component }}-${{ matrix.os }}-
type=ref,event=branch,suffix=-${{ matrix.os }},prefix=${{ matrix.component }}-
type=ref,event=branch,prefix=${{ matrix.component }}-${{ steps.base_os_tag.outputs.os_tag }}-
type=ref,event=branch,suffix=-${{ steps.base_os_tag.outputs.os_tag }},prefix=${{ matrix.component }}-
flavor: |
latest=false
@ -262,7 +274,7 @@ jobs:
os: ${{ fromJson(needs.init_build.outputs.os) }}
component: ${{ fromJson(needs.init_build.outputs.components) }}
runs-on: windows-2022
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v2.3.4
@ -271,14 +283,20 @@ jobs:
docker login -u ${{ secrets.DOCKER_USERNAME }} -p ${{ secrets.DOCKER_PASSWORD }}
if (-not $?) {throw "Failed"}
- name: Base OS tag
id: base_os_tag
run: |
$os_tag=$(Get-Content -Path .\build.json | ConvertFrom-Json).'os-windows'.'${{ matrix.os }}'
echo "::set-output name=os_tag::$os_tag"
- name: Generate tags
id: meta
uses: docker/metadata-action@v3
with:
images: ${{ env.DOCKER_REPOSITORY }}/${{ env.IMAGE_PREFIX }}${{ matrix.component }}
tags: |
type=ref,event=branch,prefix=${{ matrix.os }}-
type=ref,event=branch,suffix=-${{ matrix.os }}
type=ref,event=branch,prefix=${{ steps.base_os_tag.outputs.os_tag }}-
type=ref,event=branch,suffix=-${{ steps.base_os_tag.outputs.os_tag }}
flavor: |
latest=false

View File

@ -1,5 +1,5 @@
{
"os": {
"os-linux": {
"alpine": [
"linux/amd64",
"linux/arm/v6",
@ -20,6 +20,11 @@
"linux/arm64"
]
},
"os-windows": {
"windows-2022": "ltsc2022",
"windows-2019": "ltsc2019",
"windows-2016": "ltsc2016"
},
"components": {
"agent": "build-mysql",
"agent2": "build-mysql",