fix workflows #9
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: publish | |
on: | |
push: | |
branches: | |
- main | |
paths: | |
- "Cargo.lock" | |
- "Cargo.toml" | |
- "src/**" | |
- ".github/workflows/*" | |
permissions: | |
contents: write | |
jobs: | |
create-release: | |
name: ${{ matrix.name }} | |
runs-on: ${{ matrix.os }} | |
strategy: | |
matrix: | |
os: [ubuntu-latest, macos-latest, windows-latest] | |
include: | |
- os: ubuntu-latest | |
name: Linux Binary 64-Bit | |
target: x86_64-unknown-linux-musl | |
- os: macos-latest | |
name: MacOS Binary 64-Bit | |
target: x86_64-apple-darwin | |
target2: aarch64-apple-darwin | |
env: | |
MACOSX_DEPLOYMENT_TARGET: 10.7 | |
- os: windows-latest | |
name: Windows Binary 64-Bit | |
target: x86_64-pc-windows-msvc | |
steps: | |
- name: Check out repository | |
uses: actions/checkout@v4 | |
- name: Initialize and update submodules | |
run: | | |
git submodule sync | |
git submodule update --init --recursive | |
- name: Run tests | |
run: cargo test --verbose | |
- name: Add rustup default target | |
run: rustup target add ${{ matrix.target }} | |
- name: Add rustup Apple ARM64 target | |
if: ${{ matrix.os == 'macos-latest' }} | |
run: rustup target add ${{ matrix.target2 }} | |
- name: Build default target in release mode | |
run: cargo build --release --target ${{ matrix.target }} --locked | |
- name: Build Apple ARM64 target in release mode | |
if: ${{ matrix.os == 'macos-latest' }} | |
run: cargo build --release --target ${{ matrix.target2 }} --locked | |
- name: Create zip file on Windows | |
if: ${{ matrix.os == 'windows-latest' }} | |
run: | | |
choco install zip | |
cd target/${{ matrix.target }}/release | |
zip ti-tools-0.1.4-${{ matrix.target }}.zip ti-tools.exe | |
cd ../../.. | |
- name: Create tar.gz file on macOS | |
if: ${{ matrix.os == 'macos-latest' }} | |
run: | | |
chmod +x target/${{ matrix.target }}/release/ti-tools | |
tar -zcf target/${{ matrix.target }}/release/ti-tools-0.1.4-${{ matrix.target }}.tar.gz -C target/${{ matrix.target }}/release ti-tools | |
chmod +x target/${{ matrix.target2 }}/release/ti-tools | |
tar -zcf target/${{ matrix.target2 }}/release/ti-tools-0.1.4-${{ matrix.target2 }}.tar.gz -C target/${{ matrix.target2 }}/release ti-tools | |
- name: Create tar.gz file on Linux | |
if: ${{ matrix.os == 'ubuntu-latest' }} | |
run: | | |
chmod +x target/${{ matrix.target }}/release/ti-tools | |
tar -zcf target/${{ matrix.target }}/release/ti-tools-0.1.4-${{ matrix.target }}.tar.gz -C target/${{ matrix.target }}/release ti-tools | |
- name: Upload release and assets to GitHub | |
uses: svenstaro/upload-release-action@v2 | |
with: | |
repo_token: ${{ secrets.GITHUB_TOKEN }} | |
tag: "release-0.1.4-${{ github.run_number }}" | |
release_name: ti-tools 0.1.4 | |
file_glob: true | |
file: target/*/release/ti-tools-0.1.4-*.{zip,tar.gz} |