Skip to content

Commit

Permalink
Create release.yml
Browse files Browse the repository at this point in the history
  • Loading branch information
Lapis256 authored Jul 23, 2024
1 parent f71d720 commit 7d6c42d
Showing 1 changed file with 66 additions and 0 deletions.
66 changes: 66 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
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
- os: windows-latest
target: x86_64-pc-windows-msvc
glibc: -1

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
# 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.job.target }}/release/${{ env.PROJECT_NAME }}{,-${{ github.ref_name }}-${{ matrix.job.target }}${{ matrix.job.extension }}}
# ビルド済みバイナリをReleasesに配置
- name: Release
uses: softprops/action-gh-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
files: |
target/${{ matrix.job.target }}/release/${{ env.PROJECT_NAME }}-${{ github.ref_name }}-${{ matrix.job.target }}${{ matrix.job.extension }}

0 comments on commit 7d6c42d

Please sign in to comment.