Skip to content

Release

Release #12

Workflow file for this run

name: Release
on:
release:
types: [created]
jobs:
release:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
include:
- os: ubuntu-latest
binname: tlauc-linux.tar.gz
- os: macos-latest
binname: tlauc-macos.tar.gz
- os: windows-latest
binname: tlauc-windows.zip
fail-fast: true
steps:
- name: Clone repo
uses: actions/checkout@v4
- name: Set package version
if: matrix.os != 'windows-latest'
run: |
sed -i -e "s/\"0\.0\.0\"/\"${{ github.ref_name }}\"/" Cargo.toml
cat Cargo.toml
- name: Set package version
if: matrix.os == 'windows-latest'
run: |
function Convert-PackageFile {
param($path, $source, $target)
$packageFile = Get-Content -Path $path -Raw
$updatedPackageFile = $packageFile -replace [Regex]::Escape($source), $target
Set-Content -Path $path -Value $updatedPackageFile
$updatedPackageFile
}
Convert-PackageFile 'Cargo.toml' '"0.0.0"' """${{ github.ref_name }}"""
- name: Use stable rust toolchain
run: rustup default stable
- name: Build
run: cargo build --release
- name: Package Binary
if: matrix.os == 'windows-latest'
shell: pwsh
run: Compress-Archive -Path target/release/tlauc.exe -DestinationPath ${{ matrix.binname }}
- name: Package Binary
if: matrix.os == 'ubuntu-latest' || matrix.os == 'macos-latest'
run: tar -czvf ${{ matrix.binname }} -C target/release tlauc
- name: Upload Binary
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GH_PAT }}
with:
upload_url: ${{ github.event.release.upload_url }}
asset_path: ${{ matrix.binname }}
asset_name: ${{ matrix.binname }}
asset_content_type: application/gzip
- name: Publish Crate
if: matrix.os == 'ubuntu-latest'
run: cargo publish --token ${{secrets.CRATES_AUTH_TOKEN}}