Skip to content

{"schema":"decodex/commit/1","summary":"Land vstyle performance telem… #23

{"schema":"decodex/commit/1","summary":"Land vstyle performance telem…

{"schema":"decodex/commit/1","summary":"Land vstyle performance telem… #23

Workflow file for this run

name: Release
permissions:
contents: write
env:
CARGO_REGISTRIES_CRATES_IO_PROTOCOL: sparse
CARGO_TERM_COLOR: always
RUST_BACKTRACE: full
on:
push:
tags:
- "v[0-9]+.[0-9]+.[0-9]+"
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: ${{ github.ref != 'refs/heads/main' }}
jobs:
build:
name: Build ${{ matrix.target.name }} binary
runs-on: ${{ matrix.target.os }}
strategy:
matrix:
target:
[
{ name: aarch64-apple-darwin, os: macos-latest },
{ name: x86_64-unknown-linux-gnu, os: ubuntu-latest },
{ name: x86_64-pc-windows-msvc, os: windows-latest },
]
steps:
- name: Fetch latest code
uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
- name: Set up Rust toolchain
uses: actions-rust-lang/setup-rust-toolchain@166cdcfd11aee3cb47222f9ddb555ce30ddb9659 # v1.17.0
with:
cache: true
components: rustfmt, clippy
- name: Add target
run: rustup target add ${{ matrix.target.name }}
- name: Build
run: cargo build --profile final-release --locked --target ${{ matrix.target.name }}
- name: Archive binaries (macOS)
if: matrix.target.os == 'macos-latest'
run: |
VERSION="${GITHUB_REF_NAME#v}"
PKG_NAME="vibe-style-${{ matrix.target.name }}-v${VERSION}"
mkdir -p "${PKG_NAME}"
cp target/${{ matrix.target.name }}/final-release/vstyle "${PKG_NAME}/vstyle"
cp target/${{ matrix.target.name }}/final-release/cargo-vstyle "${PKG_NAME}/cargo-vstyle"
tar -czf "${PKG_NAME}.tgz" "${PKG_NAME}"
- name: Archive binaries (Windows)
if: matrix.target.os == 'windows-latest'
shell: pwsh
run: |
$version = $env:GITHUB_REF_NAME.Substring(1)
$pkgName = "vibe-style-${{ matrix.target.name }}-v$version"
New-Item -ItemType Directory -Path $pkgName | Out-Null
Copy-Item "target/${{ matrix.target.name }}/final-release/vstyle.exe" "$pkgName/vstyle.exe"
Copy-Item "target/${{ matrix.target.name }}/final-release/cargo-vstyle.exe" "$pkgName/cargo-vstyle.exe"
Compress-Archive -Path $pkgName -DestinationPath "$pkgName.zip"
- name: Archive binaries (Linux)
if: matrix.target.os == 'ubuntu-latest'
run: |
VERSION="${GITHUB_REF_NAME#v}"
PKG_NAME="vibe-style-${{ matrix.target.name }}-v${VERSION}"
mkdir -p "${PKG_NAME}"
cp target/${{ matrix.target.name }}/final-release/vstyle "${PKG_NAME}/vstyle"
cp target/${{ matrix.target.name }}/final-release/cargo-vstyle "${PKG_NAME}/cargo-vstyle"
tar -czf "${PKG_NAME}.tgz" "${PKG_NAME}"
- name: Upload artifact
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
with:
name: vibe-style-${{ matrix.target.name }}
path: vibe-style-${{ matrix.target.name }}-v*.*
retention-days: 1
release:
name: Publish binary release
runs-on: ubuntu-latest
needs: [build]
steps:
- name: Download artifacts
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
- name: Collect release assets
run: |
mkdir -p artifacts
mv vibe-style-*/* artifacts/
- name: Publish
uses: softprops/action-gh-release@718ea10b132b3b2eba29c1007bb80653f286566b # v3.0.1
with:
generate_release_notes: true
files: artifacts/*
publish-on-crates-io:
name: Publish on crates.io
runs-on: ubuntu-latest
needs: [release]
if: startsWith(github.ref, 'refs/tags/v')
steps:
- name: Fetch latest code
uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
- name: Set up Rust toolchain
uses: actions-rust-lang/setup-rust-toolchain@166cdcfd11aee3cb47222f9ddb555ce30ddb9659 # v1.17.0
with:
cache: true
components: rustfmt, clippy
- name: Publish
run: cargo publish --locked --token "${{ secrets.CARGO_REGISTRY_TOKEN }}"