Skip to content

Fix release.yml

Fix release.yml #4

Workflow file for this run

name: Release
permissions:
contents: write
on:
push:
tags:
- v*
jobs:
build:
name: Release binary
strategy:
matrix:
include:
- os: ubuntu-latest
target: x86_64-unknown-linux-gnu
glibc: 2.17
extension: ""
- os: windows-latest
target: x86_64-pc-windows-msvc
glibc: -1
extension: .exe
runs-on: ${{ matrix.os }}
steps:
- name: Checkout
uses: actions/checkout@v2
# Rustのpackage名を取得して環境変数に入れておく。(後のステップで使用)
- name: Extract crate information
shell: bash
run: |
echo "PROJECT_NAME=$(sed -n 's/^name = "\(.*\)"/\1/p' Cargo.toml | head -n1)" >> $GITHUB_ENV
# zigをインストール
- name: Install Zig
uses: goto-bus-stop/setup-zig@v2
# rustをインストール
- name: Install Rust toolchain
uses: moonrepo/setup-rust@v1
with:
targets: ${{ matrix.target }}
bins: cargo-zigbuild
# ビルド
- name: Build with glibc version
if: matrix.glibc != -1
run: |
cargo zigbuild --release --target ${{ matrix.target }}.${{ matrix.glibc }}
- name: Build without glibc version
if: matrix.glibc == -1
run: |
cargo zigbuild --release --target ${{ matrix.target }}
# ビルド済みバイナリをリネーム
- name: Rename artifacts
shell: bash
run: |
mv target/${{ matrix.target }}/release/${{ env.PROJECT_NAME }}{,-${{ github.ref_name }}-${{ matrix.target }}${{ matrix.extension }}}
# ビルド済みバイナリをReleasesに配置
- name: Release
uses: softprops/action-gh-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
files: |
target/${{ matrix.target }}/release/${{ env.PROJECT_NAME }}-${{ github.ref_name }}-${{ matrix.target }}${{ matrix.extension }}