Skip to content

update version

update version #1

Workflow file for this run

name: Release
on:
push:
tags:
- "v*"
permissions:
contents: write
jobs:
build:
strategy:
matrix:
include:
- os: ubuntu-22.04
target: x86_64-unknown-linux-gnu
archive_ext: tar.xz
- os: windows-2022
target: x86_64-pc-windows-msvc
archive_ext: zip
- os: macos-13
target: x86_64-apple-darwin
archive_ext: tar.xz
- os: macos-14
target: aarch64-apple-darwin
archive_ext: tar.xz
runs-on: ${{ matrix.os }}
env:
CARGO_TERM_COLOR: always
steps:
- uses: actions/checkout@v4
- name: Install Rust toolchain
uses: actions-rs/toolchain@v1
with:
toolchain: stable
target: ${{ matrix.target }}
override: true
- name: Build release binary
run: cargo build --release --target ${{ matrix.target }}
- name: Package binary (Unix)
if: runner.os != 'Windows'
shell: bash
run: |
TOOL_NAME="chaoscoder"
VERSION="${GITHUB_REF##*/}"
ARCHIVE_NAME="${TOOL_NAME}-${VERSION}-${{ matrix.target }}.${{ matrix.archive_ext }}"
BIN_PATH="target/${{ matrix.target }}/release/$TOOL_NAME"
mkdir -p dist
tar -cJf "dist/$ARCHIVE_NAME" -C "$(dirname "$BIN_PATH")" "$TOOL_NAME"
# Use shasum on macOS and sha256sum on Linux
if command -v sha256sum >/dev/null 2>&1; then
sha256sum "dist/$ARCHIVE_NAME" > "dist/$ARCHIVE_NAME.sha256"
else
shasum -a 256 "dist/$ARCHIVE_NAME" > "dist/$ARCHIVE_NAME.sha256"
fi
- name: Package binary (Windows)
if: runner.os == 'Windows'
shell: powershell
run: |
$ToolName = "chaoscoder.exe"
$Version = "${{ github.ref_name }}"
$ArchiveName = "chaoscoder-$Version-${{ matrix.target }}.zip"
$BinPath = "target/${{ matrix.target }}/release/$ToolName"
mkdir dist
Compress-Archive -Path $BinPath -DestinationPath "dist/$ArchiveName"
$Hash = Get-FileHash -Algorithm SHA256 "dist/$ArchiveName"
"$($Hash.Hash) *$ArchiveName" | Out-File -Encoding ascii -NoNewline "dist/$ArchiveName.sha256"
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: chaoscoder-${{ matrix.target }}
path: dist/
release:
needs: build
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4
- name: Download all artifacts
uses: actions/download-artifact@v4
with:
path: dist/
merge-multiple: true
- name: Create GitHub Release
uses: softprops/action-gh-release@v2
with:
files: |
dist/**/*.tar.xz
dist/**/*.zip
dist/**/*.sha256
tag_name: ${{ github.ref_name }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}