fix(build): fixed build process with github actions

This commit is contained in:
Patryk Hegenberg 2024-05-03 09:01:07 +02:00
parent 9a4a86f877
commit 69393fc79c

View file

@ -7,29 +7,29 @@ on:
- "*" - "*"
jobs: jobs:
publish: create-release:
name: ${{ matrix.name }} runs-on: ubuntu-latest
runs-on: ${{ matrix.os }} steps:
- uses: actions/checkout@v4
- uses: taiki-e/create-gh-release-action@v1
with:
token: ${{ secrets.GITHUB_TOKEN }}
upload-assets:
needs: create-release
strategy: strategy:
matrix: matrix:
include: include:
- name: Windows - target: x86_64-unknown-linux-gnu
os: windows-latest
artifact_name: caesar.exe
asset_name: caesar-windows.exe
- name: MacOS
os: macos-latest
artifact_name: caesar
asset_name: caesar-macos
- name: Linux
os: ubuntu-latest os: ubuntu-latest
artifact_name: caesar - target: x86_64-pc-windows-msvc
asset_name: caesar-linux os: windows-latest
- target: x86_64-apple-darwin
os: macos-latest
runs-on: ${{ matrix.os }}
steps: steps:
- name: Checkout - name: Checkout
uses: actions/checkout@v3 uses: actions/checkout@v4
- name: Install deps on MacOS - name: Install deps on MacOS
if: matrix.os == 'macos-latest' if: matrix.os == 'macos-latest'
run: brew install protobuf run: brew install protobuf
@ -42,40 +42,12 @@ jobs:
if: matrix.os == 'ubuntu-latest' if: matrix.os == 'ubuntu-latest'
run: sudo apt-get -y install protobuf-compiler run: sudo apt-get -y install protobuf-compiler
- uses: actions-rs/toolchain@v1 - name: Upload
uses: taiki-e/upload-rust-binary-action@v1
with: with:
toolchain: stable bin: caesar
profile: minimal target: ${{ matrix.target }}
override: true build-tool: cargo
tar: unix
- name: Build zip: windows
run: cargo build --release --locked token: ${{ secrets.GITHUB_TOKEN }}
- name: Upload binaries to release
uses: actions/upload-artifact@v2
with:
name: ${{ matrix.asset_name }}
path: target/release/${{ matrix.artifact_name }}
- name: Create Release
id: create_release
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/')
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ github.ref }}
release_name: Release ${{ github.ref }}
draft: false
prerelease: false
body: "Release of ${{ github.ref }}"
- name: Upload 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: target/release/${{ matrix.artifact_name }}
asset_name: ${{ matrix.asset_name }}
asset_content_type: application/octet-stream