chore: github workflow use dtolnay/rust-toolchain

This commit is contained in:
Jack Wills
2022-11-23 03:13:11 +00:00
parent ef1a82ca7f
commit 57c1887869
+34 -40
View File
@@ -10,74 +10,64 @@ jobs:
- name: Checkout - name: Checkout
uses: actions/checkout@v3 uses: actions/checkout@v3
#########################
## Publish to crates.io #
#########################
# Publish to crates.io
- name: publish to crates.io - name: publish to crates.io
uses: katyo/publish-crates@v1 uses: katyo/publish-crates@v1
with: with:
registry-token: ${{ secrets.CRATES_IO_TOKEN }} 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 # Build for linux x86_64
- name: build release linux_x86_64 - name: build release linux_x86_64
uses: actions-rs/cargo@v1 run: cargo build --release
with: # Compress ouput into tar
command: build
args: --release
- name: compress oxker_linux_x86_64 binary - name: compress oxker_linux_x86_64 binary
run: tar -C target/release -czf ./oxker_linux_x86_64.tar.gz oxker run: tar -C target/release -czf ./oxker_linux_x86_64.tar.gz oxker
# Build for linux aarch64, aka 64 bit pi 4 # Build for linux aarch64, aka 64 bit pi 4
- name: build release arm64v8 - name: build aarch64-unknown-linux-musl
uses: actions-rs/toolchain@v1 run: cross build --target aarch64-unknown-linux-musl --release
with: # Compress ouput into tar
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: compress aarch64 binary - name: compress aarch64 binary
run: tar -C target/aarch64-unknown-linux-musl/release -czf ./oxker_linux_aarch64.tar.gz oxker 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 # Build for linux armv6, aka 32 bit pi zero w
- name: build release armv6 - name: build arm-unknown-linux-musleabihf
uses: actions-rs/toolchain@v1 run: cross build --target arm-unknown-linux-musleabihf --release
with: # Compress ouput into tar
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: compress armv6 binary - name: compress armv6 binary
run: tar -C target/arm-unknown-linux-musleabihf/release -czf ./oxker_linux_armv6.tar.gz oxker run: tar -C target/arm-unknown-linux-musleabihf/release -czf ./oxker_linux_armv6.tar.gz oxker
# Build for windows # Build for windows
- name: build release windows_x86_64 - name: build release windows_x86_64
uses: actions-rs/toolchain@v1 run: cross build --target x86_64-pc-windows-gnu --release
with: # Compress ouput into zip
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
- name: compress windows_x86_64 binary - 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 - name: Login to DockerHub
uses: docker/login-action@v2 uses: docker/login-action@v2
with: with:
username: ${{ secrets.DOCKERHUB_USERNAME }} username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }} password: ${{ secrets.DOCKERHUB_TOKEN }}
- uses: docker/setup-buildx-action@v2 - uses: docker/setup-buildx-action@v2
id: buildx id: buildx
with: with:
@@ -89,6 +79,10 @@ jobs:
--push \ --push \
-f containerised/Dockerfile . -f containerised/Dockerfile .
###################
## Create release #
###################
- name: Release - name: Release
uses: softprops/action-gh-release@v1 uses: softprops/action-gh-release@v1
with: with: