Skip to content

Fix tests

Fix tests #31

Workflow file for this run

# yamllint disable rule:line-length rule:truthy
---
name: Release
on:
push:
tags:
- 'v*'
jobs:
release:
name: Create Release
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Install jq
run: sudo apt-get install -y jq rpm
- name: Install Rust Toolchain
uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: stable
override: true
- name: Install Cargo Deb
uses: actions-rs/cargo@v1
with:
command: install
args: cargo-deb
- name: Install Cargo Rpm
uses: actions-rs/cargo@v1
with:
command: install
args: cargo-rpm
- name: Build Debian Package
uses: actions-rs/cargo@v1
with:
command: deb
- name: Build Rpm Package
uses: actions-rs/cargo@v1
with:
command: rpm
args: build
- name: Build Static Linux Binary
uses: gmiam/rust-musl-action@master
with:
args: cargo build --target x86_64-unknown-linux-musl --release --features app
- name: Create Release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ github.ref }}
release_name: Release ${{ github.ref }}
draft: false
prerelease: false
- name: Gather Debian Package Filename
id: deb_pkg_filename
run: |
export DEB_PKG_VERSION=$(echo ${{ github.ref }} | sed 's|^refs/tags/v||')
export DEB_PKG_VERSION=$(cargo read-manifest | jq -r .version | sed 's/-/~/')
echo ::set-output name=filename::mhost_${DEB_PKG_VERSION}_amd64.deb
- name: Upload Debian Package
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./target/debian/${{ steps.deb_pkg_filename.outputs.filename }}
asset_name: ${{ steps.deb_pkg_filename.outputs.filename }}
asset_content_type: application/octet-stream
- name: Gather Rpm Package Filename
id: rpm_pkg_filename
run: |
export RPM_PKG_FILENAME=$(ls -1 ./target/release/rpmbuild/RPMS/x86_64/ | head -1)
echo ::set-output name=filename::${RPM_PKG_FILENAME}
- name: Upload Rpm Package
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./target/release/rpmbuild/RPMS/x86_64/${{ steps.rpm_pkg_filename.outputs.filename }}
asset_name: ${{ steps.rpm_pkg_filename.outputs.filename }}
asset_content_type: application/octet-stream
- name: Upload Static Linux Binary
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./target/x86_64-unknown-linux-musl/release/mhost
asset_name: mhost-linux-musl-x86_64
asset_content_type: application/octet-stream
- name: Gather Docker Tag
id: docker_info
run: |
export DOCKER_TAG=$(echo ${{ github.ref }} | sed 's|^refs/tags/||')
echo ::set-output name=tag::${DOCKER_TAG}
- name: Login to DockerHub
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKER_HUB_USERNAME }}
password: ${{ secrets.DOCKER_HUB_TOKEN }}
- name: Build and Push Docker Image
uses: docker/build-push-action@v2
with:
context: distribution/docker
push: true
tags: |
lukaspustina/mhost:${{ steps.docker_info.outputs.tag }}
lukaspustina/mhost:latest
build-args: |
RELEASE_TAG=${{ steps.docker_info.outputs.tag }}