diff --git a/.github/workflows/deployment.yml b/.github/workflows/deployment.yml index 051779a9..c7a0272c 100644 --- a/.github/workflows/deployment.yml +++ b/.github/workflows/deployment.yml @@ -75,6 +75,7 @@ jobs: os: "ubuntu-18.04", target: "x86_64-unknown-linux-gnu", cross: false, + artifact: true, } - { os: "ubuntu-18.04", @@ -92,19 +93,21 @@ jobs: os: "ubuntu-18.04", target: "x86_64-unknown-linux-musl", cross: false, + artifact: true } - { os: "ubuntu-18.04", target: "i686-unknown-linux-musl", cross: true, } - - { os: "macOS-latest", target: "x86_64-apple-darwin", cross: false } + - { os: "macOS-latest", target: "x86_64-apple-darwin", cross: false, artifact: true } - { os: "windows-2019", target: "x86_64-pc-windows-msvc", cross: false, + artifact: true, } - - { os: "windows-2019", target: "i686-pc-windows-msvc", cross: false } + - { os: "windows-2019", target: "i686-pc-windows-msvc", cross: false, artifact: true } - { os: "windows-2019", target: "x86_64-pc-windows-gnu", @@ -116,6 +119,7 @@ jobs: os: "ubuntu-18.04", target: "aarch64-unknown-linux-gnu", cross: true, + artifact: true } # armv7 @@ -123,6 +127,7 @@ jobs: os: "ubuntu-18.04", target: "armv7-unknown-linux-gnueabihf", cross: true, + artifact: true } # PowerPC 64 LE @@ -231,7 +236,7 @@ jobs: asset_content_type: application/octet-stream - name: Add download asset to artifact if required - if: matrix.triple.target == 'x86_64-unknown-linux-musl' || matrix.triple.target == 'x86_64-pc-windows-msvc' || matrix.triple.target == 'i686-pc-windows-msvc' || matrix.triple.target == 'x86_64-apple-darwin' + if: matrix.triple.artifact == true run: cp ${{ env.ASSET }} artifacts/ - name: Upload artifacts @@ -244,7 +249,7 @@ jobs: if: matrix.triple.target == 'x86_64-pc-windows-msvc' shell: powershell run: | - cargo install cargo-wix + cargo install cargo-wix --version 0.3.1 --locked cargo wix init cargo wix @@ -278,7 +283,7 @@ jobs: - name: Build Debian release (Linux x86-64 GNU) if: matrix.triple.target == 'x86_64-unknown-linux-gnu' && matrix.triple.container == '' run: | - cargo install cargo-deb --version 1.29.0 + cargo install cargo-deb --version 1.29.0 --locked cargo deb cp ./target/debian/bottom_*.deb ./bottom_${{ env.RELEASE_VERSION }}_amd64.deb @@ -299,25 +304,20 @@ jobs: curl -LO "https://github.com/ClementTsang/bottom/archive/${{ env.RELEASE_VERSION }}.tar.gz" python "./deployment/packager.py" ${{ env.RELEASE_VERSION }} "./deployment/linux/arch/PKGBUILD.template" "./PKGBUILD" "SHA512" "./${{ env.RELEASE_VERSION }}.tar.gz" - - name: Build AUR binary PKGBUILD (Linux x86-64 GNU) + - name: Tar AUR PKGBUILD (Linux x86-64 GNU) if: matrix.triple.target == 'x86_64-unknown-linux-gnu' && matrix.triple.container == '' run: | - python "./deployment/packager.py" ${{ env.RELEASE_VERSION }} "./deployment/linux/arch/PKGBUILD_BIN.template" "./PKGBUILD_BIN" "SHA512" "./bottom_x86_64-unknown-linux-gnu.tar.gz" + tar -czvf arch_PKGBUILD.tar.gz PKGBUILD - - name: Tar AUR PKGBUILDs - if: matrix.triple.target == 'x86_64-unknown-linux-gnu' && matrix.triple.container == '' - run: | - tar -czvf arch.tar.gz PKGBUILD_BIN PKGBUILD - - - name: Upload AUR PKGBUILDs (Linux x86-64 GNU) + - name: Upload AUR PKGBUILD (Linux x86-64 GNU) if: matrix.triple.target == 'x86_64-unknown-linux-gnu' && matrix.triple.container == '' uses: actions/upload-release-asset@v1.0.1 env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} with: upload_url: ${{ env.RELEASE_UPLOAD_URL }} - asset_path: arch.tar.gz - asset_name: arch.tar.gz + asset_path: arch_PKGBUILD.tar.gz + asset_name: arch_PKGBUILD.tar.gz asset_content_type: application/octet-stream additional-file-generation: @@ -380,6 +380,24 @@ jobs: asset_name: bottom.rb asset_content_type: application/octet-stream + - name: Build AUR PKGBUILD-bin + run: | + python "./deployment/packager.py" ${{ env.RELEASE_VERSION }} "./deployment/linux/arch/PKGBUILD_BIN.template" "./PKGBUILD" "SHA512" "./artifacts/bottom_x86_64-unknown-linux-gnu.tar.gz" "./artifacts/bottom_aarch64-unknown-linux-gnu.tar.gz" "./artifacts/bottom_armv7-unknown-linux-gnueabihf.tar.gz" + + - name: Tar AUR PKGBUILD-bin + run: | + tar -czvf arch_PKGBUILD_bin.tar.gz PKGBUILD + + - name: Upload AUR PKGBUILD-bin + uses: actions/upload-release-asset@v1.0.1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + upload_url: ${{ env.RELEASE_UPLOAD_URL }} + asset_path: arch_PKGBUILD_bin.tar.gz + asset_name: arch_PKGBUILD_bin.tar.gz + asset_content_type: application/octet-stream + - name: Compress completion files (Linux x86-64 GNU) if: matrix.triple.target == 'x86_64-unknown-linux-gnu' && matrix.triple.container == '' shell: bash diff --git a/.github/workflows/nightly.yml b/.github/workflows/nightly.yml index 4c3ec1ac..63046e98 100644 --- a/.github/workflows/nightly.yml +++ b/.github/workflows/nightly.yml @@ -241,7 +241,7 @@ jobs: if: matrix.triple.target == 'x86_64-pc-windows-msvc' shell: powershell run: | - cargo install cargo-wix + cargo install cargo-wix --version 0.3.1 --locked cargo wix init cargo wix @@ -259,7 +259,7 @@ jobs: - name: Build Debian release (Linux x86-64 GNU) if: matrix.triple.target == 'x86_64-unknown-linux-gnu' && matrix.triple.container == '' run: | - cargo install cargo-deb --version 1.29.0 + cargo install cargo-deb --version 1.29.0 --locked cargo deb cp ./target/debian/bottom_*.deb ./bottom_${{ env.RELEASE_VERSION }}_amd64.deb diff --git a/deployment/linux/arch/PKGBUILD.template b/deployment/linux/arch/PKGBUILD.template index b9e6ea3f..b79a4234 100644 --- a/deployment/linux/arch/PKGBUILD.template +++ b/deployment/linux/arch/PKGBUILD.template @@ -2,11 +2,11 @@ pkgname=bottom pkgver=$version -pkgrel=0 +pkgrel=1 pkgdesc="A cross-platform graphical process/system monitor with a customizable interface and a multitude of features." provides=('bottom') makedepends=('cargo') -arch=('x86_64') +arch=('x86_64' 'aarch64' 'armv7h') url="https://github.com/ClementTsang/bottom" source=("$pkgname-$pkgver.tar.gz::https://github.com/ClementTsang/bottom/archive/$pkgver.tar.gz") license=('MIT') diff --git a/deployment/linux/arch/PKGBUILD_BIN.template b/deployment/linux/arch/PKGBUILD_BIN.template index 9111363c..2549fcc0 100644 --- a/deployment/linux/arch/PKGBUILD_BIN.template +++ b/deployment/linux/arch/PKGBUILD_BIN.template @@ -2,21 +2,23 @@ pkgname=bottom-bin pkgver=$version -pkgrel=0 +pkgrel=1 pkgdesc='A cross-platform graphical process/system monitor with a customizable interface and a multitude of features.' provides=('bottom') conflicts=('bottom') -arch=('x86_64') +arch=('x86_64' 'aarch64' 'armv7h') url="https://github.com/ClementTsang/bottom" license=(MIT) -source=( - archive-${pkgver}.tar.gz::${url}/releases/download/${pkgver}/bottom_x86_64-unknown-linux-gnu.tar.gz - LICENSE::${url}/raw/${pkgver}/LICENSE -) -sha512sums=( - '$hash1' - SKIP -) + +source=(LICENSE::${url}/raw/${pkgver}/LICENSE) +source_x86_64=(archive-${pkgver}.tar.gz::${url}/releases/download/${pkgver}/bottom_x86_64-unknown-linux-gnu.tar.gz) +source_aarch64=(archive-${pkgver}.tar.gz::${url}/releases/download/${pkgver}/bottom_aarch64-unknown-linux-gnu.tar.gz) +source_armv7h=(archive-${pkgver}.tar.gz::${url}/releases/download/${pkgver}/bottom_armv7-unknown-linux-gnueabihf.tar.gz) + +sha512sums=(SKIP) +sha512sums_x86_64=('$hash1') +sha512sums_aarch64=('$hash2') +sha512sums_armv7h=('$hash3') package() { install -Dm755 btm "$pkgdir"/usr/bin/btm diff --git a/deployment/packager.py b/deployment/packager.py index 1f96fc99..30f56182 100644 --- a/deployment/packager.py +++ b/deployment/packager.py @@ -13,10 +13,13 @@ hash_type = args[4] # Deployment files deployment_file_path_1 = args[5] deployment_file_path_2 = args[6] if len(args) > 6 else None +deployment_file_path_3 = args[7] if len(args) > 7 else None print("Generating package for file: %s" % deployment_file_path_1) if deployment_file_path_2 is not None: print("and for file: %s" % deployment_file_path_2) +if deployment_file_path_3 is not None: + print("and for file: %s" % deployment_file_path_3) print(" VERSION: %s" % version) print(" TEMPLATE PATH: %s" % template_file_path) print(" SAVING AT: %s" % generated_file_path) @@ -31,8 +34,7 @@ def get_hash(deployment_file): elif str.lower(hash_type) == "sha1": deployment_hash = hashlib.sha1(deployment_file.read()).hexdigest() else: - print( - 'Unsupported hash format "%s". Please use SHA512, SHA256, or SHA1.', hash_type) + print('Unsupported hash format "%s". Please use SHA512, SHA256, or SHA1.', hash_type) exit(1) print("Generated hash: %s" % str(deployment_hash)) @@ -47,11 +49,24 @@ with open(deployment_file_path_1, "rb") as deployment_file_1: with open(deployment_file_path_2, "rb") as deployment_file_2: deployment_hash_2 = get_hash(deployment_file_2) + deployment_hash_3 = None + if deployment_file_path_3 is not None: + with open(deployment_file_path_3, "rb") as deployment_file_3: + deployment_hash_3 = get_hash(deployment_file_3) + with open(template_file_path, "r") as template_file: template = Template(template_file.read()) - substitute = template.safe_substitute( - version=version, hash1=deployment_hash_1) if deployment_hash_2 is None else template.safe_substitute( - version=version, hash1=deployment_hash_1, hash2=deployment_hash_2) + + substitutes = dict() + substitutes["version"] = version + substitutes["hash1"] = deployment_hash_1 + if deployment_hash_2 is not None: + substitutes["hash2"] = deployment_hash_2 + if deployment_hash_3 is not None: + substitutes["hash3"] = deployment_hash_3 + + substitute = template.safe_substitute(substitutes) + print("\n================== Generated package file ==================\n") print(substitute) print("\n============================================================\n")