Skip to content

Commit

Permalink
update actions
Browse files Browse the repository at this point in the history
  • Loading branch information
Umio-Yasuno committed Jan 28, 2025
1 parent 99f01d8 commit a761e5e
Showing 1 changed file with 49 additions and 10 deletions.
59 changes: 49 additions & 10 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,15 @@ name: release
on:
push:
tags:
- "v[0-9]+.[0-9]+.[0-9]+"
# - "v[0-9]+.[0-9]+.[0-9]+"

permissions:
contents: write

jobs:
create-release:
name: create-release
runs-on: ubuntu-latest
runs-on: [ubuntu-22.04, ubuntu-22.04-arm]
steps:
- uses: actions/checkout@v4
- name: Get the tag name
Expand All @@ -31,13 +31,20 @@ jobs:
echo "version does not match tag"
# exit 1
fi
- name: Runner Arch
run: |
# https://stackoverflow.com/questions/52996949/how-can-i-find-the-current-rust-compilers-default-llvm-target-triple
echo "RUNNER_ARCH=$(rustc -vV | sed -n 's|host: ||p')" >> $GITHUB_ENV
- name: Print Runner Arch
run: echo "$RUNNER_ARCH"
- name: Create release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: gh release create $VERSION --draft --verify-tag --title $VERSION
outputs:
version: ${{ env.VERSION }}
pkg_ver: ${{ env.PKG_VER }}
runner_arch: ${{ env.RUNNER_ARCH }}

build:
name: build
Expand All @@ -46,7 +53,8 @@ jobs:
APPIMAGETOOL: tools/appimagetool
VERSION: ${{needs.create-release.outputs.version}}
PKG_VER: ${{needs.create-release.outputs.pkg_ver}}
runs-on: ubuntu-latest
RUNNER_ARCH: ${{needs.create-release.outputs.runner_arch}}
runs-on: [ubuntu-22.04, ubuntu-22.04-arm]
steps:
- uses: actions/checkout@v4
- name: Check Version env
Expand All @@ -64,7 +72,11 @@ jobs:
- name: Download appimagetool
run: |
mkdir tools
curl -o $APPIMAGETOOL -L -O https://github.com/AppImage/appimagetool/releases/download/continuous/appimagetool-x86_64.AppImage
if [ "${RUNNER_ARCH}" == "x86_64-unknown-linux-gnu" ]; then
curl -o $APPIMAGETOOL -L -O https://github.com/AppImage/appimagetool/releases/download/continuous/appimagetool-x86_64.AppImage
else
curl -o $APPIMAGETOOL -L -O https://github.com/AppImage/appimagetool/releases/download/continuous/appimagetool-aarch64.AppImage
fi
chmod +x $APPIMAGETOOL
- name: Install cargo-deb
run: mold -run cargo install cargo-deb
Expand All @@ -80,6 +92,11 @@ jobs:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
TGZ_NAME="amdgpu_top-${{ env.PKG_VER }}-x86_64-unknown-linux-gnu.tar.gz"
if ! [ "${RUNNER_ARCH}" == "x86_64-unknown-linux-gnu" ]; then
TGZ_NAME="amdgpu_top-${{ env.PKG_VER }}-aarch64-unknown-linux-gnu.tar.gz"
fi
cp ./target/release/amdgpu_top ./
tar czf "$TGZ_NAME" amdgpu_top
gh release upload "$VERSION" "$TGZ_NAME"
Expand All @@ -89,28 +106,50 @@ jobs:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
mold -run cargo deb -- --no-default-features --features="package"
gh release upload "$VERSION" ./target/debian/amdgpu-top_${{ env.PKG_VER }}-1_amd64.deb
if [ "${RUNNER_ARCH}" == "x86_64-unknown-linux-gnu" ]; then
gh release upload "$VERSION" ./target/debian/amdgpu-top_${{ env.PKG_VER }}-1_amd64.deb
else
gh release upload "$VERSION" ./target/debian/amdgpu-top_${{ env.PKG_VER }}-1_arm64.deb
fi
- name: Build RPM Pakcage
shell: bash
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
mold -run cargo generate-rpm
gh release upload "$VERSION" ./target/generate-rpm/amdgpu_top-${{ env.PKG_VER }}-1.x86_64.rpm
if [ "${RUNNER_ARCH}" == "x86_64-unknown-linux-gnu" ]; then
gh release upload "$VERSION" ./target/generate-rpm/amdgpu_top-${{ env.PKG_VER }}-1.x86_64.rpm
else
gh release upload "$VERSION" ./target/generate-rpm/amdgpu_top-${{ env.PKG_VER }}-1.aarch64.rpm
fi
- name: Build AppImage
shell: bash
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
PATH=$PATH:$PWD/tools/
mold -run cargo appimage --no-default-features --features="package"
cp ./target/appimage/amdgpu_top.AppImage amdgpu_top-x86_64.AppImage
gh release upload "$VERSION" amdgpu_top-x86_64.AppImage
if [ "${RUNNER_ARCH}" == "x86_64-unknown-linux-gnu" ]; then
cp ./target/appimage/amdgpu_top.AppImage amdgpu_top-x86_64.AppImage
gh release upload "$VERSION" amdgpu_top-x86_64.AppImage
else
cp ./target/appimage/amdgpu_top.AppImage amdgpu_top-aarch64.AppImage
gh release upload "$VERSION" amdgpu_top-aarch64.AppImage
fi
- name: Build Deb Package without GUI
shell: bash
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
mold -run cargo deb -- --no-default-features --features="tui, json"
mv ./target/debian/amdgpu-top{,_without_gui}_${{ env.PKG_VER }}-1_amd64.deb
gh release upload "$VERSION" ./target/debian/amdgpu-top_without_gui_${{ env.PKG_VER }}-1_amd64.deb
if [ "${RUNNER_ARCH}" == "x86_64-unknown-linux-gnu" ]; then
mv ./target/debian/amdgpu-top{,_without_gui}_${{ env.PKG_VER }}-1_amd64.deb
gh release upload "$VERSION" ./target/debian/amdgpu-top_without_gui_${{ env.PKG_VER }}-1_amd64.deb
else
mv ./target/debian/amdgpu-top{,_without_gui}_${{ env.PKG_VER }}-1_arm64.deb
gh release upload "$VERSION" ./target/debian/amdgpu-top_without_gui_${{ env.PKG_VER }}-1_arm64.deb
fi

0 comments on commit a761e5e

Please sign in to comment.