SummerCart64/.github/workflows/build.yml
Mateusz Faderewski b7bda71521 test
2023-03-03 17:15:35 +01:00

121 lines
3.5 KiB
YAML

name: build
on:
push:
branches:
- main
pull_request:
branches:
- main
release:
types:
- created
workflow_dispatch:
jobs:
# build-fw-hw-sw:
# runs-on: ubuntu-latest
# steps:
# - name: Download SummerCart64 repository
# uses: actions/checkout@v3
# - name: Set SC64 version
# uses: frabert/replace-string-action@v2
# id: sc64version
# with:
# pattern: '\/'
# string: '-${{ github.ref_name }}'
# replace-with: '-'
# - name: Build everything
# run: ./docker_build.sh release --force-clean
# env:
# SC64_VERSION: ${{ steps.sc64version.outputs.replaced }}
# - name: Upload artifact
# uses: actions/upload-artifact@v3
# with:
# name: sc64-pkg${{ steps.sc64version.outputs.replaced }}
# path: |
# sc64-extra${{ steps.sc64version.outputs.replaced }}.zip
# sc64-firmware${{ steps.sc64version.outputs.replaced }}.bin
# - name: Upload release assets
# if: github.event_name == 'release' && github.event.action == 'created'
# uses: softprops/action-gh-release@v0.1.15
# with:
# files: |
# sc64-extra${{ steps.sc64version.outputs.replaced }}.zip
# sc64-firmware${{ steps.sc64version.outputs.replaced }}.bin
build-deployer:
strategy:
matrix:
os: [windows-latest, ubuntu-latest, macos-latest]
include:
- os: windows-latest
executable: sc64deployer.exe
name: sc64deployer-windows
options: -c -a -f
extension: zip
- os: ubuntu-latest
linux-packages: libudev-dev
executable: sc64deployer
name: sc64deployer-linux
options: -czf
extension: tar.gz
- os: macos-latest
executable: sc64deployer
name: sc64deployer-macos
options: -czf
extension: tgz
runs-on: ${{ matrix.os }}
steps:
- name: Download SummerCart64 repository
uses: actions/checkout@v3
- name: Set package version
uses: frabert/replace-string-action@v2
id: version
with:
pattern: '\/'
string: '-${{ github.ref_name }}'
replace-with: '-'
- name: Install linux packages
if: matrix.linux-packages
run: |
sudo apt-get update
sudo apt-get -y install ${{ matrix.linux-packages }}
- name: Build deployer
run: cargo b -r
working-directory: sw/deployer
- name: Package executable
run: |
mkdir package
cd target/release
tar ${{ matrix.options }} \
../../package/${{ matrix.name }}${{ steps.version.outputs.replaced }}.${{ matrix.extension }} \
${{ matrix.executable }}
working-directory: sw/deployer
- name: Upload artifact
uses: actions/upload-artifact@v3
with:
name: ${{ matrix.name }}${{ steps.version.outputs.replaced }}
path: sw/deployer/package/${{ matrix.name }}${{ steps.version.outputs.replaced }}.${{ matrix.extension }}
- name: Upload release assets
if: github.event_name == 'release' && github.event.action == 'created'
uses: softprops/action-gh-release@v0.1.15
with:
files: |
sw/deployer/package/${{ matrix.name }}${{ steps.version.outputs.replaced }}.${{ matrix.extension }}