code improvements #8
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Release | |
on: | |
workflow_dispatch: | |
push: | |
branches: | |
- master | |
- dev | |
tags: | |
- 'v*.*.*' | |
jobs: | |
build: | |
runs-on: ${{matrix.target}} | |
container: ${{matrix.container}} | |
name: dist (${{matrix.target}}) | |
strategy: | |
matrix: | |
include: | |
- os: ubuntu-20.04 | |
target: x86_64-unknown-linux-gnu | |
code-target: linux-x64 | |
container: ubuntu:18.04 | |
- os: ubuntu-20.04 | |
target: aarch64-unknown-linux-gnu | |
code-target: linux-arm64 | |
- os: ubuntu-20.04 | |
target: arm-unknown-linux-gnueabihf | |
code-target: linux-armhf | |
- os: macos-11 | |
target: x86_64-apple-darwin | |
code-target: darwin-x64 | |
- os: macos-11 | |
target: aarch64-apple-darwin | |
code-target: darwin-arm64 | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v2 | |
- name: Install Rust toolchain | |
run: | | |
rustup update --no-self-update stable | |
rustup target add ${{ matrix.target }} | |
rustup component add rust-src | |
- name: Update apt repositories | |
if: matrix.target == 'aarch64-unknown-linux-gnu' || matrix.target == 'arm-unknown-linux-gnueabihf' | |
run: sudo apt-get update | |
- name: Install AArch64 target toolchain | |
if: matrix.target == 'aarch64-unknown-linux-gnu' | |
run: sudo apt-get install gcc-aarch64-linux-gnu | |
- name: Install ARM target toolchain | |
if: matrix.target == 'arm-unknown-linux-gnueabihf' | |
run: sudo apt-get install gcc-arm-linux-gnueabihf | |
- name: Build | |
run: cargo build --release --target ${{ matrix.target }} | |
- name: Upload artifact | |
uses: actions/upload-artifact@v2 | |
with: | |
name: tiller-${{ matrix.target }} | |
path: target/${{ matrix.target }}/release/tiller | |
release: | |
needs: build | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
include: | |
- os: ubuntu-20.04 | |
target: x86_64-unknown-linux-gnu | |
code-target: linux-x64 | |
container: ubuntu:18.04 | |
- os: ubuntu-20.04 | |
target: aarch64-unknown-linux-gnu | |
code-target: linux-arm64 | |
- os: ubuntu-20.04 | |
target: arm-unknown-linux-gnueabihf | |
code-target: linux-armhf | |
- os: macos-11 | |
target: x86_64-apple-darwin | |
code-target: darwin-x64 | |
- os: macos-11 | |
target: aarch64-apple-darwin | |
code-target: darwin-arm64 | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v2 | |
- name: Download artifacts | |
uses: actions/download-artifact@v2 | |
with: | |
name: tiller-${{ matrix.target }} | |
path: tiller-${{ matrix.target }} | |
- 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: Upload ${{matrix.target}} binary to release | |
uses: actions/upload-release-asset@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
upload_url: ${{ steps.create_release.outputs.upload_url }} | |
asset_path: tiller-${{matrix.target}}/tiller | |
asset_name: tiller-${{matrix.target}} | |
asset_content_type: application/octet-stream | |