Merge pull request #86 from jabibamman/develop #282
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: Rust CI | |
on: | |
push: | |
branches: | |
- master | |
- develop | |
tags: | |
- '*' | |
pull_request: | |
branches: | |
- develop | |
env: | |
CARGO_TERM_COLOR: always | |
jobs: | |
build: | |
runs-on: ${{ matrix.os }} | |
strategy: | |
matrix: | |
os: [ubuntu-latest, windows-latest, macos-latest] | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Build | |
run: cargo build --release --verbose | |
- name: Run tests | |
run: cargo test --verbose | |
- name: Upload client artifact | |
uses: actions/upload-artifact@v3 | |
with: | |
name: client-${{ matrix.os }} | |
path: | | |
${{ (matrix.os == 'windows-latest' && 'target/release/client.exe') || 'target/release/client' }} | |
- name: Upload server artifact | |
uses: actions/upload-artifact@v3 | |
with: | |
name: server-${{ matrix.os }} | |
path: | | |
${{ (matrix.os == 'windows-latest' && 'target/release/server.exe') || 'target/release/server' }} | |
publish_release: | |
needs: build | |
runs-on: ubuntu-latest | |
permissions: | |
contents: write | |
issues: read | |
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/') | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Download all artifacts | |
uses: actions/download-artifact@v3 | |
with: | |
path: artifacts/ | |
- name: Create Release | |
id: create_release | |
uses: actions/create-release@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
tag_name: ${{ github.ref_name }} | |
release_name: Release ${{ github.ref_name }} | |
draft: false | |
prerelease: false | |
- name: Upload macOS Client Release Asset | |
uses: actions/upload-release-asset@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
upload_url: ${{ steps.create_release.outputs.upload_url }} | |
asset_path: ./artifacts/client-macos-latest/client | |
asset_name: client-macos-latest.zip | |
asset_content_type: application/zip | |
- name: Upload Ubuntu Client Release Asset | |
uses: actions/upload-release-asset@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
upload_url: ${{ steps.create_release.outputs.upload_url }} | |
asset_path: ./artifacts/client-ubuntu-latest/client | |
asset_name: client-ubuntu-latest.zip | |
asset_content_type: application/zip | |
- name: Upload Windows Client Release Asset | |
uses: actions/upload-release-asset@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
upload_url: ${{ steps.create_release.outputs.upload_url }} | |
asset_path: ./artifacts/client-windows-latest/client.exe | |
asset_name: client-windows-latest.zip | |
asset_content_type: application/zip | |
- name: Upload macOS Server Release Asset | |
uses: actions/upload-release-asset@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
upload_url: ${{ steps.create_release.outputs.upload_url }} | |
asset_path: ./artifacts/server-macos-latest/server | |
asset_name: server-macos-latest.zip | |
asset_content_type: application/zip | |
- name: Upload Ubuntu Server Release Asset | |
uses: actions/upload-release-asset@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
upload_url: ${{ steps.create_release.outputs.upload_url }} | |
asset_path: ./artifacts/server-ubuntu-latest/server | |
asset_name: server-ubuntu-latest.zip | |
asset_content_type: application/zip | |
- name: Upload Windows Server Release Asset | |
uses: actions/upload-release-asset@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
upload_url: ${{ steps.create_release.outputs.upload_url }} | |
asset_path: ./artifacts/server-windows-latest/server.exe | |
asset_name: server-windows-latest.zip | |
asset_content_type: application/zip | |