From eb28321042194d1bf95c72e2a98b5e307a1dc7cf Mon Sep 17 00:00:00 2001 From: Markson Hon <50002150+MarksonHon@users.noreply.github.com> Date: Sun, 16 Jul 2023 14:30:29 +0800 Subject: [PATCH] ci(build.yml): fix armv7 packages' architecture (#145) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * ci(build.yml): fix armv7 packages' architecture * build.yml: Fix Arch Linux ARM armv7 and aarch64 build * build.yml: don't build useless arch mips package * build.yml: don't build useless arch mips package * build.yml: fix skip arch package mips builds * build.yml: fix skip arch package mips upload * trigger build * build.yml: Fix typo * trigger build * Update .github/workflows/build.yml Co-authored-by: kunish <17328586+kunish@users.noreply.github.com> * Revert "Update .github/workflows/build.yml" This reverts commit 21b580c36608d58a04dd6e83878f1f84e0a0f320. * ci: sync to and --------- Co-authored-by: 火力全开加特林 Co-authored-by: kunish <17328586+kunish@users.noreply.github.com> Co-authored-by: Kevin Yu <31861128+yqlbu@users.noreply.github.com> --- .github/workflows/build.yml | 48 +++++++++++++++++++++++++++++--- .github/workflows/prerelease.yml | 48 +++++++++++++++++++++++++++++--- .github/workflows/release.yml | 48 +++++++++++++++++++++++++++++--- 3 files changed, 132 insertions(+), 12 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 5b81ac25..d795e559 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -196,8 +196,37 @@ jobs: sudo apt install -y libarchive-tools rpm sudo gem install fpm -v 1.15.1 pushd bundled || exit 1 - for package_manager in deb rpm pacman; do - fpm -s dir -t "$package_manager" -a $GOARCH --version "$PACKAGE_VERSION" \ + if [ "$GOARCH" == 'mips64' ] || [ "$GOARCH" == 'mips64le' ] || [ "$GOARCH" == 'mipsle' ] || [ "$GOARCH" == 'mips' ];then + echo "Skip pacman package build for Arch Linux has never been port to MIPS family, Debian package and RPM package are enough." + ARCH_PACMAN='' + else + ARCH_PACMAN='pacman' + fi + for package_manager in deb rpm $ARCH_PACMAN; do + if [ "$package_manager" == 'pacman' ];then + if [ "$GOARCH" == 'arm' ] && [ "$GOARM" == '7' ];then + package_arch='arm7hf' + elif [ "$GOARCH" == 'arm64' ];then + package_arch='aarch64' + else + package_arch="$GOARCH" + fi + elif [ "$package_manager" == 'rpm' ];then + if [ "$GOARCH" == 'arm' ] && [ "$GOARM" == '7' ];then + package_arch='armhfp' + elif [ "$GOARCH" == 'arm64' ];then + package_arch='aarch64' + else + package_arch="$GOARCH" + fi + elif [ "$package_manager" == 'deb' ];then + if [ "$GOARCH" == 'arm' ] && [ "$GOARM" == '7' ];then + package_arch='armhf' + else + package_arch="$GOARCH" + fi + fi + fpm -s dir -t "$package_manager" -a $package_arch --version "$PACKAGE_VERSION" \ --url 'https://github.com/daeuniverse/daed' --description "daed, A Modern Dashboard For dae." \ --maintainer "daed@dae.v2raya.org" --name daed --license 'MIT AGPL' \ --package daed-linux-$GOARCH$GOAMD64$GOARM.$package_manager \ @@ -210,14 +239,25 @@ jobs: popd || exit 1 cp bundled/daed-linux-$GOARCH$GOAMD64$GOARM.deb installer-${{ steps.get_filename.outputs.BUNDLE_NAME }}.deb cp bundled/daed-linux-$GOARCH$GOAMD64$GOARM.rpm installer-${{ steps.get_filename.outputs.BUNDLE_NAME }}.rpm - cp bundled/daed-linux-$GOARCH$GOAMD64$GOARM.pacman installer-${{ steps.get_filename.outputs.BUNDLE_NAME }}.pkg.tar.zst + if [ "$ARCH_PACMAN" == 'pacman' ];then + cp bundled/daed-linux-$GOARCH$GOAMD64$GOARM.pacman installer-${{ steps.get_filename.outputs.BUNDLE_NAME }}.pkg.tar.zst + fi + ls | grep -E ".deb|.rpm|.pkg.tar.zst" fi - name: Upload Linux packages - if: ${{ env.GOARM != '5' && env.GOARM != '6' }} + if: ${{ env.GOARM != '5' && env.GOARM != '6' && env.GOARCH != 'mips' && env.GOARCH != 'mipsle' && env.GOARCH != 'mips64' && env.GOARCH != 'mips64le' }} uses: nanoufo/action-upload-artifacts-and-release-assets@v1.5 with: path: | installer-${{ steps.get_filename.outputs.BUNDLE_NAME }}.deb installer-${{ steps.get_filename.outputs.BUNDLE_NAME }}.rpm installer-${{ steps.get_filename.outputs.BUNDLE_NAME }}.pkg.tar.zst + + - name: Upload Linux packages without Arch Linux package + if: ${{ env.GOARCH == 'mips' || env.GOARCH == 'mipsle' || env.GOARCH == 'mips64' || env.GOARCH == 'mips64le' }} + uses: nanoufo/action-upload-artifacts-and-release-assets@v1.5 + with: + path: | + installer-${{ steps.get_filename.outputs.BUNDLE_NAME }}.deb + installer-${{ steps.get_filename.outputs.BUNDLE_NAME }}.rpm diff --git a/.github/workflows/prerelease.yml b/.github/workflows/prerelease.yml index 1ca38b4d..bbc60fc4 100644 --- a/.github/workflows/prerelease.yml +++ b/.github/workflows/prerelease.yml @@ -196,8 +196,37 @@ jobs: sudo apt install -y libarchive-tools rpm sudo gem install fpm -v 1.15.1 pushd bundled || exit 1 - for package_manager in deb rpm pacman; do - fpm -s dir -t "$package_manager" -a $GOARCH --version "$PACKAGE_VERSION" \ + if [ "$GOARCH" == 'mips64' ] || [ "$GOARCH" == 'mips64le' ] || [ "$GOARCH" == 'mipsle' ] || [ "$GOARCH" == 'mips' ];then + echo "Skip pacman package build for Arch Linux has never been port to MIPS family, Debian package and RPM package are enough." + ARCH_PACMAN='' + else + ARCH_PACMAN='pacman' + fi + for package_manager in deb rpm $ARCH_PACMAN; do + if [ "$package_manager" == 'pacman' ];then + if [ "$GOARCH" == 'arm' ] && [ "$GOARM" == '7' ];then + package_arch='arm7hf' + elif [ "$GOARCH" == 'arm64' ];then + package_arch='aarch64' + else + package_arch="$GOARCH" + fi + elif [ "$package_manager" == 'rpm' ];then + if [ "$GOARCH" == 'arm' ] && [ "$GOARM" == '7' ];then + package_arch='armhfp' + elif [ "$GOARCH" == 'arm64' ];then + package_arch='aarch64' + else + package_arch="$GOARCH" + fi + elif [ "$package_manager" == 'deb' ];then + if [ "$GOARCH" == 'arm' ] && [ "$GOARM" == '7' ];then + package_arch='armhf' + else + package_arch="$GOARCH" + fi + fi + fpm -s dir -t "$package_manager" -a $package_arch --version "$PACKAGE_VERSION" \ --url 'https://github.com/daeuniverse/daed' --description "daed, A Modern Dashboard For dae." \ --maintainer "daed@dae.v2raya.org" --name daed --license 'MIT AGPL' \ --package daed-linux-$GOARCH$GOAMD64$GOARM.$package_manager \ @@ -210,11 +239,14 @@ jobs: popd || exit 1 cp bundled/daed-linux-$GOARCH$GOAMD64$GOARM.deb installer-${{ steps.get_filename.outputs.BUNDLE_NAME }}.deb cp bundled/daed-linux-$GOARCH$GOAMD64$GOARM.rpm installer-${{ steps.get_filename.outputs.BUNDLE_NAME }}.rpm - cp bundled/daed-linux-$GOARCH$GOAMD64$GOARM.pacman installer-${{ steps.get_filename.outputs.BUNDLE_NAME }}.pkg.tar.zst + if [ "$ARCH_PACMAN" == 'pacman' ];then + cp bundled/daed-linux-$GOARCH$GOAMD64$GOARM.pacman installer-${{ steps.get_filename.outputs.BUNDLE_NAME }}.pkg.tar.zst + fi + ls | grep -E ".deb|.rpm|.pkg.tar.zst" fi - name: Upload Linux packages - if: ${{ env.GOARM != '5' && env.GOARM != '6' }} + if: ${{ env.GOARM != '5' && env.GOARM != '6' && env.GOARCH != 'mips' && env.GOARCH != 'mipsle' && env.GOARCH != 'mips64' && env.GOARCH != 'mips64le' }} uses: nanoufo/action-upload-artifacts-and-release-assets@v1.5 with: path: | @@ -222,6 +254,14 @@ jobs: installer-${{ steps.get_filename.outputs.BUNDLE_NAME }}.rpm installer-${{ steps.get_filename.outputs.BUNDLE_NAME }}.pkg.tar.zst + - name: Upload Linux packages without Arch Linux package + if: ${{ env.GOARCH == 'mips' || env.GOARCH == 'mipsle' || env.GOARCH == 'mips64' || env.GOARCH == 'mips64le' }} + uses: nanoufo/action-upload-artifacts-and-release-assets@v1.5 + with: + path: | + installer-${{ steps.get_filename.outputs.BUNDLE_NAME }}.deb + installer-${{ steps.get_filename.outputs.BUNDLE_NAME }}.rpm + upload-prerelease: needs: [checkout-full-src, build-bundle] runs-on: ubuntu-latest diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index c4802cd5..5db3f25b 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -188,8 +188,37 @@ jobs: sudo apt install -y libarchive-tools rpm sudo gem install fpm -v 1.15.1 pushd bundled || exit 1 - for package_manager in deb rpm pacman; do - fpm -s dir -t "$package_manager" -a $GOARCH --version "$PACKAGE_VERSION" \ + if [ "$GOARCH" == 'mips64' ] || [ "$GOARCH" == 'mips64le' ] || [ "$GOARCH" == 'mipsle' ] || [ "$GOARCH" == 'mips' ];then + echo "Skip pacman package build for Arch Linux has never been port to MIPS family, Debian package and RPM package are enough." + ARCH_PACMAN='' + else + ARCH_PACMAN='pacman' + fi + for package_manager in deb rpm $ARCH_PACMAN; do + if [ "$package_manager" == 'pacman' ];then + if [ "$GOARCH" == 'arm' ] && [ "$GOARM" == '7' ];then + package_arch='arm7hf' + elif [ "$GOARCH" == 'arm64' ];then + package_arch='aarch64' + else + package_arch="$GOARCH" + fi + elif [ "$package_manager" == 'rpm' ];then + if [ "$GOARCH" == 'arm' ] && [ "$GOARM" == '7' ];then + package_arch='armhfp' + elif [ "$GOARCH" == 'arm64' ];then + package_arch='aarch64' + else + package_arch="$GOARCH" + fi + elif [ "$package_manager" == 'deb' ];then + if [ "$GOARCH" == 'arm' ] && [ "$GOARM" == '7' ];then + package_arch='armhf' + else + package_arch="$GOARCH" + fi + fi + fpm -s dir -t "$package_manager" -a $package_arch --version "$PACKAGE_VERSION" \ --url 'https://github.com/daeuniverse/daed' --description "daed, A Modern Dashboard For dae." \ --maintainer "daed@dae.v2raya.org" --name daed --license 'MIT AGPL' \ --package daed-linux-$GOARCH$GOAMD64$GOARM.$package_manager \ @@ -202,11 +231,14 @@ jobs: popd || exit 1 cp bundled/daed-linux-$GOARCH$GOAMD64$GOARM.deb installer-${{ steps.get_filename.outputs.BUNDLE_NAME }}.deb cp bundled/daed-linux-$GOARCH$GOAMD64$GOARM.rpm installer-${{ steps.get_filename.outputs.BUNDLE_NAME }}.rpm - cp bundled/daed-linux-$GOARCH$GOAMD64$GOARM.pacman installer-${{ steps.get_filename.outputs.BUNDLE_NAME }}.pkg.tar.zst + if [ "$ARCH_PACMAN" == 'pacman' ];then + cp bundled/daed-linux-$GOARCH$GOAMD64$GOARM.pacman installer-${{ steps.get_filename.outputs.BUNDLE_NAME }}.pkg.tar.zst + fi + ls | grep -E ".deb|.rpm|.pkg.tar.zst" fi - name: Upload Linux packages - if: ${{ env.GOARM != '5' && env.GOARM != '6' }} + if: ${{ env.GOARM != '5' && env.GOARM != '6' && env.GOARCH != 'mips' && env.GOARCH != 'mipsle' && env.GOARCH != 'mips64' && env.GOARCH != 'mips64le' }} uses: nanoufo/action-upload-artifacts-and-release-assets@v1.5 with: path: | @@ -214,6 +246,14 @@ jobs: installer-${{ steps.get_filename.outputs.BUNDLE_NAME }}.rpm installer-${{ steps.get_filename.outputs.BUNDLE_NAME }}.pkg.tar.zst + - name: Upload Linux packages without Arch Linux package + if: ${{ env.GOARCH == 'mips' || env.GOARCH == 'mipsle' || env.GOARCH == 'mips64' || env.GOARCH == 'mips64le' }} + uses: nanoufo/action-upload-artifacts-and-release-assets@v1.5 + with: + path: | + installer-${{ steps.get_filename.outputs.BUNDLE_NAME }}.deb + installer-${{ steps.get_filename.outputs.BUNDLE_NAME }}.rpm + upload-release: needs: [checkout-full-src, build-bundle] runs-on: ubuntu-latest