SummerCart64/.github/workflows/build.yml

122 lines
3.5 KiB
YAML
Raw Normal View History

name: build
2021-02-14 22:19:38 +01:00
on:
push:
branches:
- main
pull_request:
branches:
- main
2021-02-14 22:19:38 +01:00
release:
types:
- created
2021-02-14 22:19:38 +01:00
workflow_dispatch:
jobs:
2023-03-03 17:51:17 +01:00
build-firmware:
2023-03-03 17:45:38 +01:00
runs-on: ubuntu-latest
steps:
- name: Download SummerCart64 repository
uses: actions/checkout@v3
2023-03-03 17:53:27 +01:00
- name: Set package version
2023-03-03 17:45:38 +01:00
uses: frabert/replace-string-action@v2
2023-03-03 17:53:27 +01:00
id: version
2023-03-03 17:45:38 +01:00
with:
pattern: '\/'
string: '-${{ github.ref_name }}'
replace-with: '-'
- name: Build firmware
run: ./docker_build.sh release --force-clean
env:
2023-03-03 17:53:27 +01:00
SC64_VERSION: ${{ steps.version.outputs.replaced }}
2023-03-03 17:45:38 +01:00
- name: Upload artifact
uses: actions/upload-artifact@v3
with:
2023-03-03 17:53:27 +01:00
name: sc64-pkg${{ steps.version.outputs.replaced }}
2023-03-03 17:45:38 +01:00
path: |
2023-03-03 17:53:27 +01:00
sc64-extra${{ steps.version.outputs.replaced }}.zip
sc64-firmware${{ steps.version.outputs.replaced }}.bin
2023-03-03 17:45:38 +01:00
- name: Upload release assets
if: github.event_name == 'release' && github.event.action == 'created'
uses: softprops/action-gh-release@v0.1.15
with:
files: |
2023-03-03 17:53:27 +01:00
sc64-extra${{ steps.version.outputs.replaced }}.zip
sc64-firmware${{ steps.version.outputs.replaced }}.bin
2023-03-02 00:48:01 +01:00
build-deployer:
strategy:
matrix:
os: [windows-latest, ubuntu-latest, macos-latest]
include:
- os: windows-latest
2023-03-03 17:15:35 +01:00
executable: sc64deployer.exe
2023-03-03 17:51:17 +01:00
name: sc64-deployer-windows
2023-03-03 17:15:35 +01:00
options: -c -a -f
extension: zip
- os: ubuntu-latest
2023-03-02 01:15:15 +01:00
linux-packages: libudev-dev
2023-03-08 18:02:40 +01:00
rust-flags: -C target-feature=+crt-static
2023-03-03 17:15:35 +01:00
executable: sc64deployer
2023-03-03 17:51:17 +01:00
name: sc64-deployer-linux
2023-03-03 17:15:35 +01:00
options: -czf
extension: tar.gz
- os: macos-latest
2023-03-03 17:15:35 +01:00
executable: sc64deployer
2023-03-03 17:51:17 +01:00
name: sc64-deployer-macos
2023-03-03 17:15:35 +01:00
options: -czf
extension: tgz
2021-02-14 22:19:38 +01:00
runs-on: ${{ matrix.os }}
steps:
- name: Download SummerCart64 repository
uses: actions/checkout@v3
2023-03-03 17:15:35 +01:00
- name: Set package version
uses: frabert/replace-string-action@v2
2023-03-03 17:15:35 +01:00
id: version
with:
pattern: '\/'
string: '-${{ github.ref_name }}'
replace-with: '-'
2023-03-03 17:15:35 +01:00
- name: Install linux packages
2023-03-02 01:15:15 +01:00
if: matrix.linux-packages
2023-03-02 00:56:41 +01:00
run: |
sudo apt-get update
2023-03-02 01:15:15 +01:00
sudo apt-get -y install ${{ matrix.linux-packages }}
2023-03-02 00:54:24 +01:00
2023-03-02 00:48:01 +01:00
- name: Build deployer
run: cargo b -r
working-directory: sw/deployer
2023-03-08 18:02:40 +01:00
env:
RUSTFLAGS: ${{ matrix.rust-flags }}
2023-03-02 00:48:01 +01:00
2023-03-03 17:15:35 +01:00
- name: Package executable
run: |
mkdir package
cd target/release
2023-03-03 17:24:35 +01:00
tar ${{ matrix.options }} ../../package/${{ matrix.name }}${{ steps.version.outputs.replaced }}.${{ matrix.extension }} ${{ matrix.executable }}
2023-03-03 17:15:35 +01:00
working-directory: sw/deployer
- name: Upload artifact
uses: actions/upload-artifact@v3
with:
2023-03-03 17:15:35 +01:00
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 }}