Skip to content

Merge pull request #29 from Tahinli/dev #199

Merge pull request #29 from Tahinli/dev

Merge pull request #29 from Tahinli/dev #199

Workflow file for this run

name: Rust -> Build & Test & Release
on:
push:
branches: ["main"]
env:
CARGO_TERM_COLOR: always
PROJECT_NAME: ${{ github.event.repository.name }}
jobs:
build_linux:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Build
run: cargo build --release --verbose
- name: Run tests
run: cargo test --verbose
- name: Upload Linux Binary
uses: actions/upload-artifact@v4
with:
name: ${{ env.PROJECT_NAME }}-linux-x64_86
path: target/release/${{ env.PROJECT_NAME }}
build_windows:
runs-on: windows-latest
steps:
- uses: actions/checkout@v4
- name: Build
run: cargo build --release --verbose
- name: Run tests
run: cargo test --verbose
- name: Upload Windows Binary
uses: actions/upload-artifact@v4
with:
name: ${{ env.PROJECT_NAME }}-windows-x64_86
path: target/release/${{ env.PROJECT_NAME }}.exe
build_macos:
runs-on: macos-latest
steps:
- uses: actions/checkout@v4
- name: Build
run: cargo build --release --verbose
- name: Run tests
run: cargo test --verbose
- name: Upload MacOS Binary
uses: actions/upload-artifact@v4
with:
name: ${{ env.PROJECT_NAME }}-macos-arm64
path: target/release/${{ env.PROJECT_NAME }}
release:
needs: [build_linux, build_windows, build_macos]
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- uses: actions/checkout@v4
- name: Forge a Folder
run: mkdir Downloads
working-directory: /home/runner/work/${{ env.PROJECT_NAME }}/${{ env.PROJECT_NAME }}/
- uses: actions/download-artifact@v4
name: Download
with:
path: Downloads/
- name: Rename Binaries
run: |
tree Downloads/
mv Downloads/${{ env.PROJECT_NAME }}-linux-x64_86/${{ env.PROJECT_NAME }} Downloads/${{ env.PROJECT_NAME }}-linux-x64_86/${{ env.PROJECT_NAME }}-linux-x64_86
mv Downloads/${{ env.PROJECT_NAME }}-windows-x64_86/${{ env.PROJECT_NAME }}.exe Downloads/${{ env.PROJECT_NAME }}-windows-x64_86/${{ env.PROJECT_NAME }}-windows-x64_86.exe
mv Downloads/${{ env.PROJECT_NAME }}-macos-arm64/${{ env.PROJECT_NAME }} Downloads/${{ env.PROJECT_NAME }}-macos-arm64/${{ env.PROJECT_NAME }}-macos-arm64
- name: Git Commit SHA
id: vars
run: |
calculatedSha=$(git rev-parse --short ${{ github.sha }})
echo "short_sha=$calculatedSha" >> $GITHUB_OUTPUT
- uses: softprops/action-gh-release@v2
name: Release
with:
tag_name: ${{ steps.vars.outputs.short_sha }}
generate_release_notes: true
files: |
Downloads/*linux*/${{ env.PROJECT_NAME }}*
Downloads/*windows*/${{ env.PROJECT_NAME }}*
Downloads/*macos*/${{ env.PROJECT_NAME }}*