Refactoring workflow (#448)
This commit is contained in:
parent
c7a1fd04a4
commit
29e4ec3027
2 changed files with 33 additions and 24 deletions
|
@ -1,5 +1,5 @@
|
||||||
### This workflow setup instance then build and push images ###
|
### This workflow setup instance then build and push images ###
|
||||||
name: Multi-arch build 4testing
|
name: 4testing multiarch-build
|
||||||
|
|
||||||
on:
|
on:
|
||||||
push:
|
push:
|
||||||
|
@ -15,10 +15,12 @@ jobs:
|
||||||
build:
|
build:
|
||||||
name: Build
|
name: Build
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
continue-on-error: ${{ matrix.condition }}
|
||||||
strategy:
|
strategy:
|
||||||
matrix:
|
matrix:
|
||||||
edition: ["", "-ee", "-de"]
|
|
||||||
images: ["documentserver"]
|
images: ["documentserver"]
|
||||||
|
edition: ["", "-ee", "-de"]
|
||||||
|
condition: [true]
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout code
|
- name: Checkout code
|
||||||
uses: actions/checkout@v3
|
uses: actions/checkout@v3
|
||||||
|
@ -40,7 +42,7 @@ jobs:
|
||||||
run: |
|
run: |
|
||||||
echo ::set-output name=SOURCE_TAG::${GITHUB_REF#refs/tags/}
|
echo ::set-output name=SOURCE_TAG::${GITHUB_REF#refs/tags/}
|
||||||
|
|
||||||
- name: Build documentserver-4testing
|
- name: Build 4testing
|
||||||
run: |
|
run: |
|
||||||
DOCKER_TAG=$(echo ${{ steps.tag_name.outputs.SOURCE_TAG }} | sed 's/^.//' )
|
DOCKER_TAG=$(echo ${{ steps.tag_name.outputs.SOURCE_TAG }} | sed 's/^.//' )
|
||||||
PACKAGE_VERSION=$(echo $DOCKER_TAG | sed 's/\./-/3')
|
PACKAGE_VERSION=$(echo $DOCKER_TAG | sed 's/\./-/3')
|
||||||
|
@ -48,23 +50,26 @@ jobs:
|
||||||
STATUS=$(curl -s -o /dev/null -w "%{http_code}\n" "$PACKAGE_URL")
|
STATUS=$(curl -s -o /dev/null -w "%{http_code}\n" "$PACKAGE_URL")
|
||||||
if [[ "$STATUS" = "200" ]]; then
|
if [[ "$STATUS" = "200" ]]; then
|
||||||
echo "Have access to documentserver${{ matrix.edition }} amd64 arch >> check arm64 access"
|
echo "Have access to documentserver${{ matrix.edition }} amd64 arch >> check arm64 access"
|
||||||
PACKAGE_URL=${{ secrets.REPO_URL }}${{ matrix.edition }}_"$PACKAGE_VERSION"_arm64.deb
|
|
||||||
STATUS=$(curl -s -o /dev/null -w "%{http_code}\n" "$PACKAGE_URL")
|
|
||||||
if [[ "$STATUS" = "200" ]]; then
|
|
||||||
echo "Have access to documentserver${{ matrix.edition }} arm64 arch"
|
|
||||||
echo "All architecture are available >> Build is starting."
|
|
||||||
sed -i "s|http://download.onlyoffice.com/install/documentserver/linux/\${COMPANY_NAME}-\${PRODUCT_NAME}\${PRODUCT_EDITION}|${{ secrets.REPO_URL }}${{ matrix.edition }}_$PACKAGE_VERSION|g" Dockerfile
|
|
||||||
PRODUCT_EDITION=${{ matrix.edition }} COMPANY_NAME=${{ env.COMPANY_NAME }} \
|
|
||||||
PRODUCT_NAME=${{ env.PRODUCT_NAME }} DOCKERFILE=Dockerfile \
|
|
||||||
PREFIX_NAME=4testing- TAG=$DOCKER_TAG \
|
|
||||||
docker buildx bake \
|
|
||||||
-f docker-bake.hcl ${{ matrix.images }} \
|
|
||||||
--push
|
|
||||||
echo "DONE: Build success >> exit with 0"
|
|
||||||
exit 0
|
|
||||||
else
|
else
|
||||||
echo "FAILED: Have no access to some required architecture documentserver${{ matrix.edition }} >> Build did't started >> Exit with 0."
|
echo "FAILED: Have no access to documentserver${{ matrix.edition }} amd64 arch"
|
||||||
exit 0
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
PACKAGE_URL=${{ secrets.REPO_URL }}${{ matrix.edition }}_"$PACKAGE_VERSION"_arm64.deb
|
||||||
|
STATUS=$(curl -s -o /dev/null -w "%{http_code}\n" "$PACKAGE_URL")
|
||||||
|
if [[ "$STATUS" = "200" ]]; then
|
||||||
|
echo "Have access to documentserver${{ matrix.edition }} arm64 arch"
|
||||||
|
echo "All architecture are available >> build is starting."
|
||||||
|
sed -i "s|http://download.onlyoffice.com/install/documentserver/linux/\${COMPANY_NAME}-\${PRODUCT_NAME}\${PRODUCT_EDITION}|${{ secrets.REPO_URL }}${{ matrix.edition }}_$PACKAGE_VERSION|g" Dockerfile
|
||||||
|
PRODUCT_EDITION=${{ matrix.edition }} COMPANY_NAME=${{ env.COMPANY_NAME }} \
|
||||||
|
PRODUCT_NAME=${{ env.PRODUCT_NAME }} DOCKERFILE=Dockerfile \
|
||||||
|
PREFIX_NAME=4testing- TAG=$DOCKER_TAG \
|
||||||
|
docker buildx bake \
|
||||||
|
-f docker-bake.hcl ${{ matrix.images }} \
|
||||||
|
--push
|
||||||
|
echo "DONE: Build success >> exit with 0"
|
||||||
|
exit 0
|
||||||
|
else
|
||||||
|
echo "FAILED: Have no access to some required architecture documentserver${{ matrix.edition }} >> Exit with 0."
|
||||||
|
exit 1
|
||||||
fi
|
fi
|
||||||
shell: bash
|
shell: bash
|
|
@ -14,10 +14,12 @@ jobs:
|
||||||
build:
|
build:
|
||||||
name: Build
|
name: Build
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
continue-on-error: ${{ matrix.condition }}
|
||||||
strategy:
|
strategy:
|
||||||
matrix:
|
matrix:
|
||||||
images: ["documentserver-stable"]
|
images: ["documentserver-stable"]
|
||||||
edition: ["", "-ee", "-de"]
|
edition: ["", "-ee", "-de"]
|
||||||
|
condition: [true]
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout code
|
- name: Checkout code
|
||||||
uses: actions/checkout@v3
|
uses: actions/checkout@v3
|
||||||
|
@ -39,7 +41,7 @@ jobs:
|
||||||
run: |
|
run: |
|
||||||
echo ::set-output name=SOURCE_TAG::${GITHUB_REF#refs/tags/}
|
echo ::set-output name=SOURCE_TAG::${GITHUB_REF#refs/tags/}
|
||||||
|
|
||||||
- name: Build documentserver-stable
|
- name: Build documentserver-release
|
||||||
run: |
|
run: |
|
||||||
TAG=$(echo ${{ steps.tag_name.outputs.SOURCE_TAG }} | sed 's/^.//; s/-stable//')
|
TAG=$(echo ${{ steps.tag_name.outputs.SOURCE_TAG }} | sed 's/^.//; s/-stable//')
|
||||||
SHORTER_TAG=$(echo ${TAG} | grep -o -P '^[\d]+\.[\d]+\.[\d]+')
|
SHORTER_TAG=$(echo ${TAG} | grep -o -P '^[\d]+\.[\d]+\.[\d]+')
|
||||||
|
@ -55,9 +57,11 @@ jobs:
|
||||||
SHORTEST_TAG=$SHORTEST_TAG \
|
SHORTEST_TAG=$SHORTEST_TAG \
|
||||||
docker buildx bake \
|
docker buildx bake \
|
||||||
-f docker-bake.hcl ${{ matrix.images }} \
|
-f docker-bake.hcl ${{ matrix.images }} \
|
||||||
--push ;
|
--push
|
||||||
else
|
echo "DONE: Build success >> exit with 0"
|
||||||
echo "FAILED: Image with tag $TAG do not presented on docker.hub >> build will not started >> exit with 0"
|
|
||||||
exit 0
|
exit 0
|
||||||
|
else
|
||||||
|
echo "FAILED: Image with tag $TAG do not presented on docker.hub >> build will not started >> exit with 1"
|
||||||
|
exit 1
|
||||||
fi
|
fi
|
||||||
shell: bash
|
shell: bash
|
Loading…
Reference in a new issue