Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
85 changes: 85 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
name: Build and Release PS3Dec

on:
push:
branches: [ "main" ]
tags: [ "v*" ]
pull_request:
branches: [ "main" ]
workflow_dispatch:

jobs:
build:
name: Build on ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
include:
- os: ubuntu-latest
target: x86_64-unknown-linux-gnu
artifact_name: ps3decrs
asset_name: ps3dec-linux.tar.gz
- os: windows-latest
target: x86_64-pc-windows-msvc
artifact_name: ps3decrs.exe
asset_name: ps3dec-windows.zip
- os: macos-latest
target: x86_64-apple-darwin
artifact_name: ps3decrs
asset_name: ps3dec-macos.tar.gz

steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@stable
with:
targets: ${{ matrix.target }}

- name: Rust Cache
uses: swatinem/rust-cache@v2

- name: Build Release
run: cargo build --release --target ${{ matrix.target }}

- name: Package Artifacts (Windows)
if: matrix.os == 'windows-latest'
run: |
cd target/${{ matrix.target }}/release
tar -czf ../../../${{ matrix.asset_name }} ${{ matrix.artifact_name }}
shell: bash

- name: Package Artifacts (Linux / macOS)
if: matrix.os != 'windows-latest'
run: |
cd target/${{ matrix.target }}/release
tar -czf ../../../${{ matrix.asset_name }} ${{ matrix.artifact_name }}

- name: Upload Artifacts
uses: actions/upload-artifact@v4
with:
name: ${{ matrix.asset_name }}
path: ${{ matrix.asset_name }}

release:
name: Create GitHub Release
needs: build
if: startsWith(github.ref, 'refs/tags/v')
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Download all artifacts
uses: actions/download-artifact@v4
with:
path: artifacts
merge-multiple: true

- name: Create Release and Upload Assets
uses: softprops/action-gh-release@v2
with:
files: artifacts/*
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}