fix(release workflow): shell bash #7
Workflow file for this run
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: | |
push: | |
tags: | |
- 'v*.*.*' # Triggers on version tags like v1.0.0 | |
- 'v*.*.*a*' # Triggers on tags like v0.0.1a1 | |
jobs: | |
create-release: | |
name: create-release | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: "Create github release" | |
run: | | |
gh release create ${{ github.ref_name }} --draft --verify-tag --title "${{ github.ref_name }}" | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
build: | |
runs-on: ${{ matrix.os }} | |
strategy: | |
matrix: | |
include: | |
- os: ubuntu-latest | |
target: x86_64-unknown-linux-gnu | |
- os: ubuntu-latest | |
target: x86_64-unknown-linux-musl | |
- os: windows-latest | |
target: x86_64-pc-windows-msvc | |
- os: windows-latest | |
target: i686-pc-windows-msvc | |
- os: windows-latest | |
target: aarch64-pc-windows-msvc | |
- os: macos-latest | |
target: x86_64-apple-darwin | |
- os: macos-latest | |
target: aarch64-apple-darwin | |
env: | |
RELEASE_FOLDER: "${{ github.event.repository.name }}-${{ github.ref_name }}-${{ matrix.target }}" | |
BINARY_NAME: "${{ github.event.repository.name }}${{ matrix.os == 'windows-latest' && '.exe' || '' }}" | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Install Rust | |
uses: dtolnay/rust-toolchain@master | |
with: | |
toolchain: stable | |
target: ${{ matrix.target }} | |
- name: Build | |
run: cargo build --release --target ${{ matrix.target }} | |
- name: Prepare release folder | |
shell: bash | |
run: | | |
mkdir -p "${{ env.RELEASE_FOLDER }}" | |
cp target/${{ matrix.target }}/release/${{ env.BINARY_NAME }} "${{ env.RELEASE_FOLDER }}/" | |
cp LICENSE "${{ env.RELEASE_FOLDER }}/" | |
cp README.md "${{ env.RELEASE_FOLDER }}/" | |
- name: Compress release folder | |
shell: bash | |
run: | | |
if [[ "${{ matrix.os }}" == "windows-latest" ]]; then | |
7z a "${{ env.RELEASE_FOLDER }}" "${{ env.RELEASE_FOLDER }}.zip" | |
else | |
tar -czvf "${{ env.RELEASE_FOLDER }}.tar.gz" "${{ env.RELEASE_FOLDER }}" | |
fi | |
- name: Upload release assets | |
shell: bash | |
run: | | |
if [[ "${{ matrix.os }}" == "windows-latest" ]]; then | |
gh release upload ${{ github.ref_name }} ${{ env.RELEASE_FOLDER }}.zip | |
else | |
gh release upload ${{ github.ref_name }} ${{ env.RELEASE_FOLDER }}.tar.gz | |
fi | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |