Skip to content

build

build #4

Workflow file for this run

on:
release:
types: [created]
name: build
jobs:
build:
name: build release assets
runs-on: ${{ matrix.config.os }}
strategy:
fail-fast: false
matrix:
config:
- {os: ubuntu-latest, toolchain: stable, target: x86_64-unknown-linux-gnu}
- {os: ubuntu-latest, toolchain: stable, target: aarch64-unknown-linux-gnu}
- {os: ubuntu-latest, toolchain: stable, target: arm-unknown-linux-gnueabi}
- {os: ubuntu-latest, toolchain: stable, target: armv7-unknown-linux-gnueabihf}
- {os: ubuntu-latest, toolchain: stable, target: x86_64-unknown-linux-musl}
- {os: macos-latest, toolchain: stable, target: x86_64-apple-darwin}
- {os: windows-latest, toolchain: stable-x86_64-pc-windows-gnu, target: x86_64-pc-windows-gnu}
- {os: windows-latest, toolchain: stable-x86_64-pc-windows-msvc, target: x86_64-pc-windows-msvc}
steps:
- uses: actions-rs/toolchain@v1
with:
toolchain: ${{ matrix.config.toolchain }}
target: ${{ matrix.config.target }}
override: true
default: true
- name: checkout code
uses: actions/checkout@v1
- name: build
uses: actions-rs/cargo@v1
with:
command: build
args: --all --release
- name: get tag name
id: get_version
run: echo ::set-output name=version::``${GITHUB_REF#refs/tags/}``
shell: bash
- name: pack binaries if unix
if: matrix.config.os != 'windows-latest'
run: tar -C ./target/release -czvf yaml-validator-cli-${{ steps.get_version.outputs.version }}-${{ matrix.config.target }}.tar.gz yaml-validator-cli
- name: pack binaries if windows
if: matrix.config.os == 'windows-latest'
run: compress-archive ./target/release/yaml-validator-cli.exe yaml-validator-cli-${{ steps.get_version.outputs.version }}-${{ matrix.config.target }}.zip
- name: upload binaries to release
uses: svenstaro/upload-release-action@v1-release
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: yaml-validator-cli-${{ steps.get_version.outputs.version }}-${{ matrix.config.target }}.*
asset_name: yaml-validator-cli-${{ steps.get_version.outputs.version }}-${{ matrix.config.target }}
tag: ${{ github.ref }}
file_glob: true
overwrite: true
publish:
name: publish crates
runs-on: ubuntu-latest
steps:
- name: checkout code
uses: actions/checkout@v4
- name: publish library to crates.io
uses: katyo/publish-crates@v2
with:
path: "./yaml-validator"
registry-token: ${{ secrets.CARGO_LOGIN_TOKEN }}
args: --no-verify --package yaml-validator
ignore-unpublished-changes: true
- name: publish cli to crates.io
uses: katyo/publish-crates@v2
with:
path: "./yaml-validator-cli"
registry-token: ${{ secrets.CARGO_LOGIN_TOKEN }}
args: --no-verify --package yaml-validator-cli
ignore-unpublished-changes: true