Skip to content

Merge: master into update-checker #24

Merge: master into update-checker

Merge: master into update-checker #24

name: Build and Release
on:
push:
branches: ["master"]
env:
CARGO_TERM_COLOR: always
jobs:
build-win-x64:
runs-on: windows-latest
steps:
- uses: actions/checkout@v3
- uses: actions-rs/toolchain@v1
with:
toolchain: stable
- uses: Swatinem/rust-cache@v2
- uses: actions-rs/cargo@v1
with:
command: build
args: --release --all-features
- run: |
$tmversion = ./target/release/tmaze.exe --version | Select-String -Pattern '^tmaze ([0-9]+\.[0-9]+\.[0-9]+)$' | %{$_.Matches[0].Groups[1].Value}
$filepath = "./target/release/tmaze-${tmversion}-win-x86_64.exe"
echo "BIN_FILEPATH=$filepath" | Out-File -FilePath $Env:GITHUB_ENV -Encoding utf-8 -Append
echo "TM_VERSION=$tmversion" | Out-File -FilePath $Env:GITHUB_ENV -Encoding utf-8 -Append
mv ./target/release/tmaze.exe ${filepath}
- run: echo "$Env:GITHUB_CONTEXT"
- uses: actions/upload-artifact@v3
with:
path: ${{env.BIN_FILEPATH}}
name: release
build-linux-x64:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions-rs/toolchain@v1
with:
toolchain: stable
- uses: Swatinem/rust-cache@v2
- uses: actions-rs/cargo@v1
with:
command: build
args: --release --all-features
- run: strip ./target/release/tmaze
- run: ls -l ./target/release/
- run: |
versionregex="tmaze ([0-9]+\.[0-9]+\.[0-9]+)"
if [[ $(./target/release/tmaze --version) =~ $versionregex ]]; then
version=${BASH_REMATCH[1]}
filepath="./target/release/tmaze-$version-linux-x86_64"
echo "BIN_FILEPATH=$filepath" >> $GITHUB_ENV
echo "TM_VERSION=$version" >> $GITHUB_ENV
echo $version > ./target/release/version
mv ./target/release/tmaze $filepath
else
echo "FAIL"
fi
- uses: actions/upload-artifact@v3
with:
path: |
${{env.BIN_FILEPATH}}
./target/release/version
name: release
draft-release:
needs: ["build-win-x64", "build-linux-x64"]
runs-on: ubuntu-latest
steps:
- uses: actions/download-artifact@v3
with:
path: release-files/
name: release
- run: find ./release-files/ -type f -name "linux" -exec chmod +x ./release-files/{} \;
- run: ls ./release-files/
- run: |
version=$(<./release-files/version)
rm ./release-files/version
echo "TM_VERSION=$version" >> $GITHUB_ENV
- uses: ncipollo/release-action@v1
with:
artifacts: "./release-files/*"
token: ${{ secrets.GITHUB_TOKEN }}
commit: master
generateReleaseNotes: true
skipIfReleaseExists: true
draft: true
tag: ${{ env.TM_VERSION }}
publish-on-crates:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions-rs/toolchain@v1
with:
toolchain: stable
- name: publish cmaze
uses: katyo/publish-crates@v2
with:
path: ./cmaze
registry-token: ${{ secrets.CRATES_IO }}
ignore-unpublished-changes: true
- name: publish tmaze
uses: katyo/publish-crates@v2
with:
path: ./tmaze
registry-token: ${{ secrets.CRATES_IO }}
ignore-unpublished-changes: true