Skip to content

Merge branch 'release/0.7.5' #44

Merge branch 'release/0.7.5'

Merge branch 'release/0.7.5' #44

Workflow file for this run

name: Release
on:
push:
tags:
- '*'
jobs:
publish:
name: Building ${{ matrix.job.target }}
runs-on: ${{ matrix.job.os }}
strategy:
matrix:
rust: [stable]
job:
- os: macos-latest
os-name: macos
target: x86_64-apple-darwin
architecture: x86_64
binary-postfix: ""
use-cross: false
- os: ubuntu-latest
os-name: linux
target: x86_64-unknown-linux-gnu
architecture: x86_64
binary-postfix: ""
use-cross: false
- os: windows-latest
os-name: windows
target: x86_64-pc-windows-msvc
architecture: x86_64
binary-postfix: ".exe"
use-cross: false
- os: ubuntu-latest
os-name: linux-musl
target: x86_64-unknown-linux-musl
architecture: x86_64
binary-postfix: ""
use-cross: true
- os: ubuntu-latest
os-name: linux
target: aarch64-unknown-linux-gnu
architecture: arm64
binary-postfix: ""
use-cross: true
steps:
- name: Checkout repository
uses: actions/checkout@v2
- name: Install Rust toolchain
uses: actions-rs/toolchain@v1
with:
toolchain: ${{ matrix.rust }}
profile: minimal
override: true
- uses: Swatinem/rust-cache@v1
- name: Cargo build
uses: actions-rs/cargo@v1
with:
command: build
use-cross: ${{ matrix.job.use-cross }}
toolchain: ${{ matrix.rust }}
args: --release --features=all --target ${{ matrix.job.target }}
- name: install strip command
shell: bash
run: |
if [[ ${{ matrix.job.target }} == aarch64-unknown-linux-gnu ]]; then
sudo apt update
sudo apt-get install -y binutils-aarch64-linux-gnu
fi
- name: Packaging final binary
shell: bash
run: |
cd target/${{ matrix.job.target }}/release
####### reduce binary size by removing debug symbols #######
BINARY_NAME=rustus${{ matrix.job.binary-postfix }}
if [[ ${{ matrix.job.target }} == aarch64-unknown-linux-gnu ]]; then
GCC_PREFIX="aarch64-linux-gnu-"
else
GCC_PREFIX=""
fi
"$GCC_PREFIX"strip $BINARY_NAME
########## create tar.gz ##########
RELEASE_NAME=rustus-${GITHUB_REF/refs\/tags\//}-${{ matrix.job.os-name }}-${{ matrix.job.architecture }}
tar czvf $RELEASE_NAME.tar.gz $BINARY_NAME
########## create sha256 ##########
if [[ ${{ runner.os }} == 'Windows' ]]; then
certutil -hashfile $RELEASE_NAME.tar.gz sha256 | grep -E [A-Fa-f0-9]{64} > $RELEASE_NAME.sha256
else
shasum -a 256 $RELEASE_NAME.tar.gz > $RELEASE_NAME.sha256
fi
- name: Releasing assets
uses: softprops/action-gh-release@v1
with:
files: |
target/${{ matrix.job.target }}/release/rustus-*.tar.gz
target/${{ matrix.job.target }}/release/rustus-*.sha256
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
docker_build:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Set up QEMU
uses: docker/setup-qemu-action@v1
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
- name: Login to DockerHub
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Export version
run: echo "APP_VERSION=$(head -n 5 Cargo.toml | grep version | cut -d '"' -f2)" >> $GITHUB_ENV
- name: Build and push
uses: docker/build-push-action@v2
with:
context: .
push: true
file: deploy/Dockerfile
target: base
tags: s3rius/rustus:latest,s3rius/rustus:${{env.APP_VERSION}}
- name: Build and push rootless
uses: docker/build-push-action@v2
with:
context: .
push: true
file: deploy/Dockerfile
target: rootless
tags: s3rius/rustus:${{env.APP_VERSION}}-rootless
upload_helm:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Export version
run: echo "APP_VERSION=$(head -n 5 Cargo.toml | grep version | cut -d '"' -f2)" >> $GITHUB_ENV
- name: Publish Helm charts
uses: stefanprodan/helm-gh-pages@master
with:
token: ${{ secrets.GITHUB_TOKEN }}
charts_dir: deploy
target_dir: helm_releases
app_version: ${{env.APP_VERSION}}
upload_docs:
runs-on: ubuntu-latest
needs:
- upload_helm
steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v2
with:
python-version: 3.x
- name: Install dependencies
run: pip install mkdocs-material pygments
- name: Build docs
run: mkdocs build -d /tmp/docs
- uses: actions/checkout@v2
with:
ref: gh-pages
- name: Commit files
run: |
ls -A | grep -vE "^(.git|.gitignore|helm_releases)" | xargs rm -rfv
cp -a /tmp/docs/. .
git config --local user.email "[email protected]"
git config --local user.name "s3rius"
git add .
git commit -m "Docs update"
- name: Push changes
uses: ad-m/github-push-action@master
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
branch: gh-pages
docker_build_alpine:
runs-on: ubuntu-latest
needs:
- publish
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Set up QEMU
uses: docker/setup-qemu-action@v1
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
- name: Login to DockerHub
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Export version
run: echo "APP_VERSION=$(head -n 5 Cargo.toml | grep version | cut -d '"' -f2)" >> $GITHUB_ENV
- name: Build and push
uses: docker/build-push-action@v2
with:
context: .
push: true
file: deploy/alpine.Dockerfile
target: base
tags: s3rius/rustus:latest-alpine,s3rius/rustus:${{env.APP_VERSION}}-alpine
build-args: |
app_version=${{env.APP_VERSION}}
- name: Build and push
uses: docker/build-push-action@v2
with:
context: .
push: true
file: deploy/alpine.Dockerfile
target: rootless
tags: s3rius/rustus:${{env.APP_VERSION}}-rootless-alpine
build-args: |
app_version=${{env.APP_VERSION}}