100 lines
3.2 KiB
YAML
100 lines
3.2 KiB
YAML
name: Release CI
|
|
on:
|
|
push:
|
|
tags:
|
|
- 'v*.*.*'
|
|
jobs:
|
|
deploy:
|
|
runs-on: ubuntu-18.04
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@v3
|
|
|
|
#########################
|
|
## 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
|
|
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 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 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
|
|
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
|
|
|
|
###############################
|
|
## 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:
|
|
install: true
|
|
- name: Build for Docker Hub
|
|
run: |
|
|
docker build --platform linux/arm/v6,linux/arm64,linux/amd64 \
|
|
-t ${{ secrets.DOCKERHUB_USERNAME }}/oxker:latest \
|
|
--push \
|
|
-f containerised/Dockerfile .
|
|
|
|
###################
|
|
## Create release #
|
|
###################
|
|
|
|
- name: Release
|
|
uses: softprops/action-gh-release@v1
|
|
with:
|
|
tag_name: ${{ github.ref }}
|
|
name: ${{ github.ref_name }}
|
|
body_path: ".github/release-body.md"
|
|
draft: false
|
|
files: |
|
|
oxker_linux_x86_64.tar.gz
|
|
oxker_linux_aarch64.tar.gz
|
|
oxker_linux_armv6.tar.gz
|
|
oxker_windows_x86_64.zip
|
|
env:
|
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|