Skip to content

Commit

Permalink
add build file
Browse files Browse the repository at this point in the history
  • Loading branch information
ByteBaker committed Sep 14, 2024
1 parent 8adefca commit 308e968
Show file tree
Hide file tree
Showing 2 changed files with 44 additions and 41 deletions.
40 changes: 40 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
name: Build Project

on:
push:
branches:
- main
- release

jobs:
build:
runs-on: ${{ matrix.platform }}

strategy:
matrix:
platform: [ubuntu-latest]

steps:
# Checkout the repository
- name: Checkout code
uses: actions/checkout@v3

# Install Rust
- name: Set up Rust
uses: actions-rs/toolchain@v1
with:
toolchain: stable
profile: minimal
override: true

# Build the project
- name: Build the project
run: cargo build --release

# Upload the binary as an artifact, correctly naming it based on platform
- name: Upload binary artifact
uses: actions/upload-artifact@v3
with:
name: ${{ matrix.platform }}-binary
path: |
target/release/runlike${{ matrix.platform == 'windows-latest' && '.exe' || '' }}
45 changes: 4 additions & 41 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -1,59 +1,22 @@
name: Build and Release
name: Release Artifacts

on:
# Trigger on push to the release branch
push:
branches:
- release

jobs:
build:
runs-on: ubuntu-latest

strategy:
matrix:
# Target platforms for which binaries will be built
platform: [ubuntu-latest, windows-latest, macos-latest]

steps:
# Checkout the repository
- name: Checkout code
uses: actions/checkout@v3

# Install Rust
- name: Set up Rust
uses: actions-rs/toolchain@v1
with:
toolchain: stable
profile: minimal
override: true

# Build the project
- name: Build the project
run: cargo build --release

# Upload the binary as an artifact for the current platform
- name: Upload binary artifact
uses: actions/upload-artifact@v3
with:
name: ${{ matrix.platform }}-binary
path: |
${{ github.workspace }}/target/release/runlike${{ matrix.platform == 'windows-latest' && '.exe' || '' }}
release:
runs-on: ubuntu-latest
needs: build

strategy:
matrix:
# Target platforms for which binaries will be built
platform: [ubuntu-latest, windows-latest, macos-latest]
platform: [ubuntu-latest]

steps:
- name: Checkout code
uses: actions/checkout@v3

# Download the build artifacts from previous job
# Download the build artifacts from the build job
- name: Download artifacts
uses: actions/download-artifact@v3
with:
Expand All @@ -76,6 +39,6 @@ jobs:
uses: actions/upload-release-asset@v1
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ${{ github.workspace }}/target/release/runlike${{ matrix.platform == 'windows-latest' && '.exe' || '' }}
asset_path: target/release/runlike${{ matrix.platform == 'windows-latest' && '.exe' || '' }}
asset_name: runlike-${{ matrix.platform }}${{ matrix.platform == 'windows-latest' && '.exe' || '' }}
asset_content_type: application/octet-stream

0 comments on commit 308e968

Please sign in to comment.