From eb5e74ae67d815bf49f241d2baf319e41cf9adf8 Mon Sep 17 00:00:00 2001 From: Jack Wills <32690432+mrjackwills@users.noreply.github.com> Date: Sun, 31 Dec 2023 00:07:03 +0000 Subject: [PATCH] chore: file formatting --- .../workflows/create_release_and_build.yml | 36 +++++++++---------- install.sh | 16 ++++----- 2 files changed, 25 insertions(+), 27 deletions(-) diff --git a/.github/workflows/create_release_and_build.yml b/.github/workflows/create_release_and_build.yml index 2270b9b..5591308 100644 --- a/.github/workflows/create_release_and_build.yml +++ b/.github/workflows/create_release_and_build.yml @@ -2,10 +2,9 @@ name: Release CI on: push: tags: - - 'v[0-9]+.[0-9]+.[0-9]+' + - "v[0-9]+.[0-9]+.[0-9]+" jobs: - ################################################# ## Cross platform binary build for release page # ################################################# @@ -34,24 +33,24 @@ jobs: # Set env's - name: set names run: | - translate_platform() { case "$1" in x86_64-unknown-linux-musl) echo "linux_x86_64.tar.gz";; aarch64-unknown-linux-musl) echo "linux_aarch64.tar.gz";; arm-unknown-linux-musleabihf) echo "linux_armv6.tar.gz";; x86_64-pc-windows-gnu) echo "windows_x86_64.zip";; *) echo "Error: Unsupported platform $1"; exit 1;; esac; } - target_platform="${{ matrix.platform.target }}" - output_name=$(translate_platform "$target_platform") - echo "TARGET_OUTPUT_NAME=${output_name}" >> $GITHUB_ENV - echo "TARGET_PLATFORM=${target_platform}" >> $GITHUB_ENV - + translate_platform() { case "$1" in x86_64-unknown-linux-musl) echo "linux_x86_64.tar.gz";; aarch64-unknown-linux-musl) echo "linux_aarch64.tar.gz";; arm-unknown-linux-musleabihf) echo "linux_armv6.tar.gz";; x86_64-pc-windows-gnu) echo "windows_x86_64.zip";; *) echo "Error: Unsupported platform $1"; exit 1;; esac; } + target_platform="${{ matrix.platform.target }}" + output_name=$(translate_platform "$target_platform") + echo "TARGET_OUTPUT_NAME=${output_name}" >> $GITHUB_ENV + echo "TARGET_PLATFORM=${target_platform}" >> $GITHUB_ENV + # Build binary - name: build run: cross build --target "${TARGET_PLATFORM}" --release - + # Compress, rename, and move - name: compress run: | - if [[ $TARGET_PLATFORM == *windows-gnu* ]]; then - zip -j "./oxker_${TARGET_OUTPUT_NAME}" target/${TARGET_PLATFORM}/release/oxker.exe - else - tar -C "target/${TARGET_PLATFORM}/release" -czf "./oxker_${TARGET_OUTPUT_NAME}" oxker - fi + if [[ $TARGET_PLATFORM == *windows-gnu* ]]; then + zip -j "./oxker_${TARGET_OUTPUT_NAME}" target/${TARGET_PLATFORM}/release/oxker.exe + else + tar -C "target/${TARGET_PLATFORM}/release" -czf "./oxker_${TARGET_OUTPUT_NAME}" oxker + fi # Upload output for release page - name: Upload Artifacts @@ -91,7 +90,7 @@ jobs: ################## ## Cargo publish # ################## - + cargo_publish: needs: [create_release] runs-on: ubuntu-latest @@ -103,12 +102,11 @@ jobs: uses: katyo/publish-crates@v1 with: registry-token: ${{ secrets.CRATES_IO_TOKEN }} - ######################################### ## Build images for Dockerhub & ghcr.io # ######################################### - + image_build: needs: [cargo_publish] runs-on: ubuntu-latest @@ -138,7 +136,7 @@ jobs: id: buildx with: install: true - - name: Build for Dockerhub & ghcr.io + - name: Build for Dockerhub & ghcr.io run: | docker build --platform linux/arm/v6,linux/arm64,linux/amd64 \ -t ${{ secrets.DOCKERHUB_USERNAME }}/oxker:latest \ @@ -147,4 +145,4 @@ jobs: -t ghcr.io/${{ github.repository_owner }}/oxker:${{env.CURRENT_SEMVER}} \ --provenance=false --sbom=false \ --push \ - -f containerised/Dockerfile . \ No newline at end of file + -f containerised/Dockerfile . diff --git a/install.sh b/install.sh index c04dfc0..f6be0a8 100755 --- a/install.sh +++ b/install.sh @@ -1,15 +1,15 @@ #!/bin/bash case "$(arch)" in - x86_64) SUFFIX="x86_64";; - aarch64) SUFFIX="aarch64";; - armv6l) SUFFIX="armv6";; +x86_64) SUFFIX="x86_64" ;; +aarch64) SUFFIX="aarch64" ;; +armv6l) SUFFIX="armv6" ;; esac if [ -n "$SUFFIX" ]; then - OXKER_GZ="oxker_linux_${SUFFIX}.tar.gz" - wget "https://github.com/mrjackwills/oxker/releases/latest/download/${OXKER_GZ}" - tar xzvf "${OXKER_GZ}" oxker - install -Dm 755 oxker -t "${HOME}/.local/bin" - rm "${OXKER_GZ}" oxker + OXKER_GZ="oxker_linux_${SUFFIX}.tar.gz" + wget "https://github.com/mrjackwills/oxker/releases/latest/download/${OXKER_GZ}" + tar xzvf "${OXKER_GZ}" oxker + install -Dm 755 oxker -t "${HOME}/.local/bin" + rm "${OXKER_GZ}" oxker fi