Skip to content

Commit

Permalink
ci: update release workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
vyfor committed Dec 25, 2024
1 parent 0b8d609 commit 30e98f6
Showing 1 changed file with 25 additions and 52 deletions.
77 changes: 25 additions & 52 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,23 +3,36 @@ name: Publish Artifacts
on:
push:
tags:
- '[0-9]+\.[0-9]+\.[0-9]+'
- '[0-9]+\.[0-9]+\.0'

jobs:
build:
runs-on: ubuntu-latest
name: Build ${{ matrix.target }}
runs-on: ${{ matrix.os }}
strategy:
matrix:
target:
- x86_64-unknown-linux-gnu
- x86_64-pc-windows-gnu
- x86_64-unknown-freebsd
- i686-unknown-linux-gnu
- i686-pc-windows-gnu
- aarch64-unknown-linux-gnu
include:
- os: ubuntu-latest
target: x86_64-unknown-linux-musl
- os: ubuntu-latest
target: aarch64-unknown-linux-musl
- os: ubuntu-latest
target: i686-unknown-linux-musl

- os: macos-latest
target: x86_64-apple-darwin
- os: macos-latest
target: aarch64-apple-darwin

- os: windows-latest
target: x86_64-pc-windows-msvc
- os: windows-latest
target: aarch64-pc-windows-msvc
- os: windows-latest
target: i686-pc-windows-msvc
steps:
- name: Checkout source code
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Set up Rust
uses: actions-rs/toolchain@v1
Expand Down Expand Up @@ -55,52 +68,12 @@ jobs:
name: binaries
path: dist/*

build-macos:
runs-on: macos-latest
strategy:
matrix:
target:
- x86_64-apple-darwin
- aarch64-apple-darwin
steps:
- name: Checkout source code
uses: actions/checkout@v3

- name: Set up Rust
uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: nightly
override: true

- name: Install additional targets
run: rustup target add ${{ matrix.target }}

- name: Build the binary on macOS
run: cargo build --release --target ${{ matrix.target }}

- name: Copy macOS binaries
run: |
mkdir -p dist
ARCH=$(echo ${{ matrix.target }} | cut -d '-' -f 1)
if [[ "${{ matrix.target }}" == "x86_64-apple-darwin" ]]; then
cp target/${{ matrix.target }}/release/cord dist/${ARCH}-darwin-cord
elif [[ "${{ matrix.target }}" == "aarch64-apple-darwin" ]]; then
cp target/${{ matrix.target }}/release/cord dist/${ARCH}-darwin-cord
fi
- name: Upload artifacts
uses: actions/upload-artifact@v3
with:
name: binaries
path: dist/*

upload-artifacts:
needs: [build, build-macos]
needs: [build]
runs-on: ubuntu-latest
steps:
- name: Download artifacts
uses: actions/download-artifact@v3
uses: actions/download-artifact@v4
with:
name: binaries
path: dist
Expand Down

0 comments on commit 30e98f6

Please sign in to comment.