update release #5
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[0-9]+.[0-9]+.[0-9]+" | |
permissions: | |
contents: write # Cette ligne est cruciale pour permettre la création de releases | |
jobs: | |
build-and-release: | |
name: Release ${{ matrix.target }} | |
runs-on: ${{ matrix.os }} | |
strategy: | |
fail-fast: false | |
matrix: | |
include: | |
- target: x86_64-unknown-linux-gnu | |
os: ubuntu-latest | |
name: nebulis-linux-amd64 | |
- target: x86_64-apple-darwin | |
os: macos-latest | |
name: nebulis-darwin-amd64 | |
- target: aarch64-apple-darwin | |
os: macos-latest | |
name: nebulis-darwin-arm64 | |
- target: x86_64-pc-windows-msvc | |
os: windows-latest | |
name: nebulis-windows-amd64.exe | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 # Important pour les tags | |
- name: Install Rust | |
uses: dtolnay/rust-toolchain@stable | |
with: | |
targets: ${{ matrix.target }} | |
- name: Build binary | |
uses: actions-rs/cargo@v1 | |
with: | |
command: build | |
args: --verbose --release --target ${{ matrix.target }} | |
- name: Prepare archive | |
shell: bash | |
run: | | |
mkdir dist | |
if [ "${{ matrix.os }}" = "windows-latest" ]; then | |
cp "target/${{ matrix.target }}/release/nebulis.exe" "dist/${{ matrix.name }}" | |
else | |
cp "target/${{ matrix.target }}/release/nebulis" "dist/${{ matrix.name }}" | |
fi | |
cp README.md LICENSE dist/ | |
cd dist | |
if [ "${{ matrix.os }}" = "windows-latest" ]; then | |
7z a "../${{ matrix.name }}.zip" . | |
else | |
tar czf "../${{ matrix.name }}.tar.gz" . | |
fi | |
- name: Generate SHA-256 | |
shell: bash | |
run: | | |
if [ "${{ matrix.os }}" = "windows-latest" ]; then | |
certutil -hashfile ${{ matrix.name }}.zip SHA256 > ${{ matrix.name }}.zip.sha256 | |
elif [ "${{ matrix.os }}" = "macos-latest" ]; then | |
shasum -a 256 ${{ matrix.name }}.tar.gz > ${{ matrix.name }}.tar.gz.sha256 | |
else | |
sha256sum ${{ matrix.name }}.tar.gz > ${{ matrix.name }}.tar.gz.sha256 | |
fi | |
- name: Release | |
uses: softprops/action-gh-release@v1 | |
with: | |
files: | | |
${{ matrix.name }}.* | |
generate_release_notes: true | |
token: ${{ secrets.GITHUB_TOKEN }} # Explicitement défini | |
draft: false | |
prerelease: false | |
- name: Upload artifacts | |
uses: actions/upload-artifact@v3 | |
with: | |
name: ${{ matrix.name }} | |
path: dist/* | |
if-no-files-found: error | |
publish: | |
name: Publish to crates.io | |
runs-on: ubuntu-latest | |
environment: | |
name: crates-io | |
url: https://crates.io/crates/nebulis | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Install Rust | |
uses: dtolnay/rust-toolchain@stable | |
- name: Check format | |
run: cargo fmt -- --check | |
- name: Run tests | |
run: cargo test --all-features | |
- name: Package | |
run: cargo package --allow-dirty | |
- name: Publish to crates.io | |
env: | |
CARGO_REGISTRY_TOKEN: ${{ secrets.CRATES_IO_TOKEN }} | |
run: cargo publish --allow-dirty |