Skip to content

Commit

Permalink
Refactoring git action to build packages (#1796)
Browse files Browse the repository at this point in the history
* Refactoring of the deb package build

* Refactoring of the rpm package build
  • Loading branch information
evgeniy-antonyuk authored Nov 24, 2023
1 parent 5ef1ae9 commit 1934e0d
Showing 1 changed file with 16 additions and 35 deletions.
51 changes: 16 additions & 35 deletions .github/workflows/build_packages.yml
Original file line number Diff line number Diff line change
Expand Up @@ -90,49 +90,30 @@ jobs:
- name: Build DEB Packages
if: matrix.packageType == 'deb'
run: |
wget -O buildtools.tar.gz "https://github.com/ONLYOFFICE/$PRODUCT-buildtools/archive/$BRANCH_BUILDTOOLS.tar.gz"
tar -xvf buildtools.tar.gz --transform="s/${PRODUCT}-buildtools-$(echo "${BRANCH_BUILDTOOLS}" | tr '/' '-')/buildtools/"
wget -O client.tar.gz "https://github.com/ONLYOFFICE/$PRODUCT-client/archive/$BRANCH_CLIENT.tar.gz"
tar -xvf client.tar.gz --transform="s/$PRODUCT-client-$(echo "$BRANCH_CLIENT" | tr '/' '-')/client/"
wget -O server.tar.gz "https://github.com/ONLYOFFICE/$PRODUCT-server/archive/$BRANCH_SERVER.tar.gz"
tar -xvf server.tar.gz --transform="s/$PRODUCT-server-$(echo "$BRANCH_SERVER" | tr '/' '-')/server/"
wget -O dictionaries.tar.gz "https://github.com/ONLYOFFICE/dictionaries/archive/master.tar.gz"
tar -xvf dictionaries.tar.gz -C ./client/common/Tests/Frontend.Translations.Tests --transform="s/dictionaries-master/dictionaries/"
wget -O DocStore.tar.gz "https://github.com/ONLYOFFICE/document-templates/archive/main/community-server.tar.gz"
tar -xvf DocStore.tar.gz -C ./server/products/ASC.Files/Server --transform="s/document-templates-main-community-server/DocStore/"
rm -rf *.tar.gz
cd buildtools/install/deb/
rename -f -v "s/product([^\/]*)$/$(${{ env.PRODUCT_LOW }})\$1/g" debian/* ../common/* ../common/logrotate/*
find ../ -type f -exec sed -i "s/{{product}}/$(${{ env.PRODUCT_LOW }})/g" {} ';'
cd install/deb/
wget -q -O ./debian/source/buildtools.tar.gz "https://github.com/ONLYOFFICE/$PRODUCT-buildtools/archive/${BRANCH_BUILDTOOLS}.tar.gz"
wget -q -O ./debian/source/client.tar.gz "https://github.com/ONLYOFFICE/$PRODUCT-client/archive/${BRANCH_CLIENT}.tar.gz"
wget -q -O ./debian/source/server.tar.gz "https://github.com/ONLYOFFICE/$PRODUCT-server/archive/${BRANCH_SERVER}.tar.gz"
wget -q -O ./debian/source/dictionaries.tar.gz "https://github.com/ONLYOFFICE/dictionaries/archive/master.tar.gz"
wget -q -O ./debian/source/DocStore.tar.gz "https://github.com/ONLYOFFICE/document-templates/archive/main/community-server.tar.gz"
rename -f -v "s/product([^\/]*)$/$(${{ env.PRODUCT_LOW }})\$1/g" debian/*
find debian/ -type f -exec sed -i "s/{{product}}/$(${{ env.PRODUCT_LOW }})/g" {} ';'
sed -i "s/{{package_header_tag_version}}/$(${{ env.PRODUCT_VERSION }}).${{ env.BUILD_NUMBER }}/g" debian/changelog debian/control
dpkg-buildpackage -uc -k${{ steps.gpg_step.outputs.fingerprint }}
- name: Build RPM Packages
if: matrix.packageType == 'rpm'
run: |
cd install/rpm/SPECS
wget -q -O ./SOURCES/buildtools.tar.gz "https://github.com/ONLYOFFICE/$PRODUCT-buildtools/archive/${BRANCH_BUILDTOOLS}.tar.gz"
wget -q -O ./SOURCES/client.tar.gz "https://github.com/ONLYOFFICE/$PRODUCT-client/archive/${BRANCH_CLIENT}.tar.gz"
wget -q -O ./SOURCES/server.tar.gz "https://github.com/ONLYOFFICE/$PRODUCT-server/archive/${BRANCH_SERVER}.tar.gz"
wget -q -O ./SOURCES/dictionaries.tar.gz "https://github.com/ONLYOFFICE/dictionaries/archive/master.tar.gz"
wget -q -O ./SOURCES/DocStore.tar.gz "https://github.com/ONLYOFFICE/document-templates/archive/main/community-server.tar.gz"
mv ./SOURCES/product.rpmlintrc ./SOURCES/$(${{ env.PRODUCT_LOW }}).rpmlintrc
wget https://github.com/ONLYOFFICE/${{ env.PRODUCT }}-buildtools/archive/${{ env.BRANCH_BUILDTOOLS }}.tar.gz \
-O ./SOURCES/${{ env.PRODUCT }}-buildtools-$(echo ${{ env.BRANCH_BUILDTOOLS }} | tr '/' '-').tar.gz
wget https://github.com/ONLYOFFICE/${{ env.PRODUCT }}-client/archive/${{ env.BRANCH_CLIENT }}.tar.gz \
-O ./SOURCES/${{ env.PRODUCT }}-client-$(echo ${{ env.BRANCH_CLIENT }} | tr '/' '-').tar.gz
wget https://github.com/ONLYOFFICE/${{ env.PRODUCT }}-server/archive/${{ env.BRANCH_SERVER }}.tar.gz \
-O ./SOURCES/${{ env.PRODUCT }}-server-$(echo ${{ env.BRANCH_SERVER }} | tr '/' '-').tar.gz
wget https://github.com/ONLYOFFICE/document-templates/archive/main/community-server.tar.gz \
-O ./SOURCES/document-templates-main-community-server.tar.gz
wget https://github.com/ONLYOFFICE/dictionaries/archive/master.tar.gz \
-O ./SOURCES/dictionaries-master.tar.gz
sed -i -e '/BuildRequires/d' product.spec
rpmbuild -D "packager Ascensio System SIA <[email protected]>" \
-D "BRANCH_BUILDTOOLS $(echo ${{ env.BRANCH_BUILDTOOLS }} | tr '/' '-')" \
-D "BRANCH_CLIENT $(echo ${{ env.BRANCH_CLIENT }} | tr '/' '-')" \
-D "BRANCH_SERVER $(echo ${{ env.BRANCH_SERVER }} | tr '/' '-')" \
-D "_topdir $(pwd)" \
-D "version $(${{ env.PRODUCT_VERSION }})" \
-D "release ${{ env.BUILD_NUMBER }}" -ba product.spec
Expand All @@ -153,7 +134,7 @@ jobs:
- name: Upload DEB Packages
if: matrix.packageType == 'deb'
run: |
for deb_package in ${{ env.PACKAGE_DIRECTORY }}/buildtools/install/*.deb; do
for deb_package in ${{ env.PACKAGE_DIRECTORY }}/install/*.deb; do
echo $deb_package
curl --verbose \
--user ${{ secrets.REPO_LOGIN }}:${{ secrets.REPO_PASS }} \
Expand All @@ -173,7 +154,7 @@ jobs:
- name: Checking the DEB package for errors
if: matrix.packageType == 'deb'
run: |
lintian --profile debian ${{ env.PACKAGE_DIRECTORY }}/buildtools/install/*.deb | tee -a LINTIAN
lintian --profile debian ${{ env.PACKAGE_DIRECTORY }}/install/*.deb | tee -a LINTIAN
if grep -qE '^(W:|E:)' LINTIAN; then
echo "::warning Noticedeb=lintian::$(cat LINTIAN | awk '/^W:/ { ws += 1 } /^E:/ { es += 1 } END { print "Warnings:", ws, "Errors:", es }')"
fi
Expand Down

0 comments on commit 1934e0d

Please sign in to comment.