From 5688df3ec925460974fdbf23ebdb7831f569937d Mon Sep 17 00:00:00 2001 From: Andrew Helwer <2n8rn1w1f@mozmail.com> Date: Fri, 17 May 2024 12:11:07 -0400 Subject: [PATCH] Input release version dynamically Signed-off-by: Andrew Helwer <2n8rn1w1f@mozmail.com> --- .github/workflows/release.yml | 32 +++++++++++++++++++++----------- Cargo.toml | 2 +- 2 files changed, 22 insertions(+), 12 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 0540e82..9c68357 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -3,16 +3,7 @@ on: release: types: [created] jobs: - publish-rust-crate: - runs-on: ubuntu-latest - steps: - - name: Clone repo - uses: actions/checkout@v4 - - name: Use stable rust toolchain - run: rustup default stable - - name: Publish - run: cargo publish --token ${{secrets.CRATES_AUTH_TOKEN}} - github-release-binaries: + release: runs-on: ${{ matrix.os }} strategy: matrix: @@ -24,10 +15,26 @@ jobs: binname: tlauc-macos.tar.gz - os: windows-latest binname: tlauc-windows.zip - fail-fast: false + 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 @@ -48,4 +55,7 @@ jobs: 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}} diff --git a/Cargo.toml b/Cargo.toml index a8e4bd2..6525da2 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "tlauc" description = "Rewrites TLA⁺ specs to use Unicode symbols instead of ASCII, and vice-versa" -version = "1.0.1" +version = "0.0.0" authors = ["Andrew Helwer <2n8rn1w1f@mozmail.com>"] repository = "https://github.com/tlaplus-community/tlauc" license = "MIT"