From 57c18878690477a05d7330112a65d1d58a07901e Mon Sep 17 00:00:00 2001 From: Jack Wills <32690432+mrjackwills@users.noreply.github.com> Date: Wed, 23 Nov 2022 03:13:11 +0000 Subject: [PATCH] chore: github workflow use dtolnay/rust-toolchain --- .../workflows/create_release_and_build.yml | 74 +++++++++---------- 1 file changed, 34 insertions(+), 40 deletions(-) diff --git a/.github/workflows/create_release_and_build.yml b/.github/workflows/create_release_and_build.yml index a398b2c..be50677 100644 --- a/.github/workflows/create_release_and_build.yml +++ b/.github/workflows/create_release_and_build.yml @@ -10,74 +10,64 @@ jobs: - name: Checkout uses: actions/checkout@v3 + ######################### + ## Publish to crates.io # + ######################### - # Publish to crates.io - name: publish to crates.io uses: katyo/publish-crates@v1 with: registry-token: ${{ secrets.CRATES_IO_TOKEN }} + + #################################### + ## Build binaries for release page # + #################################### + # Install stable rust, and associated tools + - name: install rust + uses: dtolnay/rust-toolchain@stable + + # Install cross-rs + - name: install cross + run: cargo install cross --git https://github.com/cross-rs/cross + # Build for linux x86_64 - name: build release linux_x86_64 - uses: actions-rs/cargo@v1 - with: - command: build - args: --release + run: cargo build --release + # Compress ouput into tar - name: compress oxker_linux_x86_64 binary run: tar -C target/release -czf ./oxker_linux_x86_64.tar.gz oxker # Build for linux aarch64, aka 64 bit pi 4 - - name: build release arm64v8 - uses: actions-rs/toolchain@v1 - with: - toolchain: stable - target: aarch64-unknown-linux-musl - override: true - - uses: actions-rs/cargo@v1 - with: - use-cross: true - command: build - args: --target aarch64-unknown-linux-musl --release + - name: build aarch64-unknown-linux-musl + run: cross build --target aarch64-unknown-linux-musl --release + # Compress ouput into tar - name: compress aarch64 binary run: tar -C target/aarch64-unknown-linux-musl/release -czf ./oxker_linux_aarch64.tar.gz oxker # Build for linux armv6, aka 32 bit pi zero w - - name: build release armv6 - uses: actions-rs/toolchain@v1 - with: - toolchain: stable - target: arm-unknown-linux-musleabihf - override: true - - uses: actions-rs/cargo@v1 - with: - use-cross: true - command: build - args: --target arm-unknown-linux-musleabihf --release + - name: build arm-unknown-linux-musleabihf + run: cross build --target arm-unknown-linux-musleabihf --release + # Compress ouput into tar - name: compress armv6 binary run: tar -C target/arm-unknown-linux-musleabihf/release -czf ./oxker_linux_armv6.tar.gz oxker # Build for windows - name: build release windows_x86_64 - uses: actions-rs/toolchain@v1 - with: - toolchain: stable - target: x86_64-pc-windows-gnu - override: true - - uses: actions-rs/cargo@v1 - with: - use-cross: true - command: build - args: --target x86_64-pc-windows-gnu --release + run: cross build --target x86_64-pc-windows-gnu --release + # Compress ouput into zip - name: compress windows_x86_64 binary - run: zip -j ./oxker_windows_x86_64.zip target/x86_64-pc-windows-gnu/release/oxker.exe + run: zip -j ./oxker_windows_x86_64.zip target/x86_64-pc-windows-gnu/release/oxker.exe + + ############################### + ## Build images for Dockerhub # + ############################### - # Build images for Dockerhub - name: Login to DockerHub uses: docker/login-action@v2 with: username: ${{ secrets.DOCKERHUB_USERNAME }} password: ${{ secrets.DOCKERHUB_TOKEN }} - - uses: docker/setup-buildx-action@v2 id: buildx with: @@ -89,6 +79,10 @@ jobs: --push \ -f containerised/Dockerfile . + ################### + ## Create release # + ################### + - name: Release uses: softprops/action-gh-release@v1 with: