summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorClement Tsang <34804052+ClementTsang@users.noreply.github.com>2023-01-12 03:41:15 -0500
committerGitHub <noreply@github.com>2023-01-12 03:41:15 -0500
commitfffeb206de4a46cac7a1eb3179318fdaec16157e (patch)
tree1c6ae7ea5d5c9255dc9c8a0b92b03c90b3b9f1e6
parent48cd29f2dd37c28dac7719a0fcf9886ef1cca681 (diff)
ci: follow .deb naming conventions (#969)
Change the .deb file generation back to following standard naming conventions.
-rw-r--r--.github/workflows/build_releases.yml43
-rw-r--r--README.md16
-rw-r--r--build.rs6
3 files changed, 48 insertions, 17 deletions
diff --git a/.github/workflows/build_releases.yml b/.github/workflows/build_releases.yml
index 8a03910c..70f87280 100644
--- a/.github/workflows/build_releases.yml
+++ b/.github/workflows/build_releases.yml
@@ -343,6 +343,7 @@ jobs:
uses: ClementTsang/cargo-action@v0.0.3
env:
BTM_GENERATE: true
+ BTM_BUILD_RELEASE_CALLER: ${{ inputs.caller }}
with:
command: build
args: --release --locked --verbose --features deploy --target ${{ matrix.info.target }}
@@ -359,14 +360,29 @@ jobs:
run: |
gzip ./manpage/btm.1
+ - name: Prepare custom version if needed
+ if: ${{ inputs.caller == 'nightly' }}
+ id: custom-version
+ run: |
+ if [[ ${{ matrix.info.cross }} == false ]]; then
+ # x86-64 can be directly executed, so we can do the easy way out.
+ VERSION=$(./target/${{ matrix.info.target }}/release/btm -V | awk '{print $2}')
+ echo "CUSTOM_VERSION_ARG='--deb-version=$VERSION'" >> $GITHUB_OUTPUT
+ else
+ VER=$(grep -m1 "^version" Cargo.toml | awk '{print $3}' | tr -d \") # NB: Assumes the first instance of version is the build version
+ APPEND=nightly-${GITHUB_SHA::8}
+ echo "CUSTOM_VERSION_ARG='--deb-version=$VER-$APPEND'" >> $GITHUB_OUTPUT
+ fi
+
- name: Build Debian release (x86-64)
if: matrix.info.cross == false
env:
BTM_GENERATE: true
run: |
- cargo install cargo-deb --version 1.41.1 --locked
- cargo deb --no-build --target ${{ matrix.info.target }}
- cp ./target/${{ matrix.info.target }}/debian/bottom_*.deb ./bottom_${{ matrix.info.target }}.deb
+ cargo install cargo-deb --version 1.41.3 --locked
+ VERSION_ARG=$(echo ${{ steps.custom-version.outputs.CUSTOM_VERSION_ARG }} | tr -d \')
+ cargo deb --no-build --target ${{ matrix.info.target }} $VERSION_ARG
+ cp ./target/${{ matrix.info.target }}/debian/bottom_*.deb .
- name: Build Debian release (ARM)
if: matrix.info.cross == true
@@ -374,13 +390,20 @@ jobs:
BTM_GENERATE: true
run: |
docker pull ${{ matrix.info.container }}
- docker run -t --rm --mount type=bind,source="$(pwd)",target=/volume ${{ matrix.info.container }} "--variant ${{ matrix.info.dpkg }} --target ${{ matrix.info.target }} --no-build" "/volume"
- cp ./target/${{ matrix.info.target }}/debian/bottom-*.deb ./bottom_${{ matrix.info.target }}.deb
-
- - name: Test Debian release
+ VERSION_ARG=$(echo ${{ steps.custom-version.outputs.CUSTOM_VERSION_ARG }} | tr -d \')
+ docker run -t --rm --mount type=bind,source="$(pwd)",target=/volume ${{ matrix.info.container }} "--no-build --variant ${{ matrix.info.dpkg }} --target ${{ matrix.info.target }} $VERSION_ARG" "/volume"
+ cp ./target/${{ matrix.info.target }}/debian/bottom-*.deb .
+ TMP_NAME=$(find bottom-*.deb)
+ VERSION=${{ matrix.info.dpkg }}
+ mv $TMP_NAME $(echo $TMP_NAME | sed "s/-$VERSION//")
+
+ - name: Verify Debian release
+ id: verify
run: |
- dpkg -I ./bottom_${{ matrix.info.target }}.deb
- dpkg -I ./bottom_${{ matrix.info.target }}.deb | grep ${{ matrix.info.dpkg }} && echo "Found correct architecture"
+ DEB_FILE=$(find bottom_*.deb)
+ dpkg -I $DEB_FILE
+ dpkg -I $DEB_FILE | grep ${{ matrix.info.dpkg }} && echo "Found correct architecture"
+ echo "DEB_FILE=$DEB_FILE" >> $GITHUB_OUTPUT
- name: Delete generated Debian folder
run: |
@@ -391,7 +414,7 @@ jobs:
shell: bash
run: |
mkdir release
- mv bottom_${{ matrix.info.target }}.deb release/
+ mv ${{ steps.verify.outputs.DEB_FILE }} release/
- name: Save release as artifact
uses: actions/upload-artifact@83fd05a356d7e2593de66fc9913b3002723633cb # v3.1.1
diff --git a/README.md b/README.md
index f404f3eb..b81d1ed5 100644
--- a/README.md
+++ b/README.md
@@ -42,7 +42,7 @@
- [Scoop](#scoop)
- [Chocolatey](#chocolatey)
- [winget](#winget)
- - [MSI](#MSI)
+ - [Windows installer](#windows-installer)
- [Manual installation](#manual-installation)
- [Binaries](#binaries)
- [Auto-completion](#auto-completion)
@@ -155,12 +155,16 @@ A `.deb` file is provided on each [stable release](https://github.com/ClementTsa
```bash
# x86-64
-curl -LO https://github.com/ClementTsang/bottom/releases/download/0.7.1/bottom_x86_64-unknown-linux-gnu.deb
-sudo dpkg -i bottom_x86_64-unknown-linux-gnu.deb
+curl -LO https://github.com/ClementTsang/bottom/releases/download/0.7.1/bottom_0.7.1_amd64.deb
+sudo dpkg -i bottom_0.7.1_amd64.deb
# ARM64
-curl -LO https://github.com/ClementTsang/bottom/releases/download/0.7.1/bottom_aarch64-unknown-linux-gnu.deb
-sudo dpkg -i bottom_aarch64-unknown-linux-gnu.deb
+curl -LO https://github.com/ClementTsang/bottom/releases/download/0.7.1/bottom_0.7.1_arm64.deb
+sudo dpkg -i bottom_0.7.1_arm64.deb
+
+# ARM
+curl -LO https://github.com/ClementTsang/bottom/releases/download/0.7.1/bottom_0.7.1_armhf.deb
+sudo dpkg -i bottom_0.7.1_armhf.deb
```
### Snap
@@ -256,7 +260,7 @@ winget install Clement.bottom
You can uninstall via Control Panel, Options, or `winget --uninstall bottom`.
-### MSI
+### Windows installer
You can also manually install bottom as a Windows program by going to the [latest release](https://github.com/ClementTsang/bottom/releases/latest)
and installing via the `.msi` file.
diff --git a/build.rs b/build.rs
index d7c06782..a37ecf19 100644
--- a/build.rs
+++ b/build.rs
@@ -70,8 +70,12 @@ fn nightly_version() {
.and_then(|cirrus_sha: &str| cirrus_sha.get(0..8))
{
println!("cargo:rustc-env=NIGHTLY_VERSION={version}-nightly-{git_hash}");
+ } else if let Some(git_hash) =
+ option_env!("GITHUB_SHA").and_then(|gha_sha: &str| gha_sha.get(0..8))
+ {
+ println!("cargo:rustc-env=NIGHTLY_VERSION={version}-nightly-{git_hash}");
} else if let Ok(output) = std::process::Command::new("git")
- .args(["rev-parse", "--short", "HEAD"])
+ .args(["rev-parse", "--short=8", "HEAD"])
.output()
{
let git_hash = String::from_utf8(output.stdout).unwrap();