SummerCart64/.github/workflows/build.yml

135 lines
4.0 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:
build-firmware:
2021-02-14 22:19:38 +01:00
runs-on: ubuntu-latest
steps:
- name: Download SummerCart64 repository
uses: actions/checkout@v3
- name: Set package version
uses: frabert/replace-string-action@v2
id: version
2021-02-14 22:19:38 +01:00
with:
pattern: '\/'
string: '${{ github.ref_name }}'
replace-with: '-'
2023-02-11 10:42:18 +01:00
- name: Build firmware
run: ./docker_build.sh release --force-clean
env:
SC64_VERSION: ${{ steps.version.outputs.replaced }}
2021-02-14 22:19:38 +01:00
- name: Upload artifact
2023-02-11 11:43:03 +01:00
uses: actions/upload-artifact@v3
2021-02-14 22:19:38 +01:00
with:
name: sc64-pkg-${{ steps.version.outputs.replaced }}
path: |
sc64-extra-${{ steps.version.outputs.replaced }}.zip
sc64-firmware-${{ steps.version.outputs.replaced }}.bin
2021-02-14 22:19:38 +01:00
- name: Upload release assets
2021-02-14 22:19:38 +01:00
if: github.event_name == 'release' && github.event.action == 'created'
uses: softprops/action-gh-release@v0.1.15
with:
files: |
sc64-extra-${{ steps.version.outputs.replaced }}.zip
sc64-firmware-${{ steps.version.outputs.replaced }}.bin
build-deployer:
strategy:
matrix:
2023-12-17 19:54:19 +01:00
version: [windows, windows-32bit, linux, macos]
include:
2023-12-17 19:54:19 +01:00
- version: windows
os: windows-latest
2023-12-17 20:10:29 +01:00
release-dir: target/release
executable: sc64deployer.exe
name: sc64-deployer-windows
options: -c -a -f
extension: zip
2023-12-17 19:54:19 +01:00
- version: windows-32bit
os: windows-latest
2023-12-17 20:04:17 +01:00
build-params: --target=i686-pc-windows-msvc
2023-12-17 20:10:29 +01:00
release-dir: target/i686-pc-windows-msvc/release
executable: sc64deployer.exe
name: sc64-deployer-windows-32bit
2023-12-17 19:49:34 +01:00
options: -c -a -f
extension: zip
2023-12-17 19:54:19 +01:00
- version: linux
os: ubuntu-latest
linux-packages: libudev-dev
2023-12-17 20:10:29 +01:00
release-dir: target/release
executable: sc64deployer
name: sc64-deployer-linux
options: -czf
extension: tar.gz
2023-12-17 19:54:19 +01:00
- version: macos
os: macos-latest
2023-12-17 20:10:29 +01:00
release-dir: target/release
executable: sc64deployer
name: sc64-deployer-macos
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
- 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
2023-12-17 20:04:17 +01:00
run: cargo b -r ${{ matrix.build-params }}
working-directory: sw/deployer
- name: Package executable
run: |
2023-12-17 20:16:38 +01:00
PACKAGE_DIR=$(pwd)/package
mkdir -p $PACKAGE_DIR
2023-12-17 20:10:29 +01:00
cd ${{ matrix.release-dir }}
2023-12-17 20:16:38 +01:00
tar ${{ matrix.options }} $PACKAGE_DIR/${{ 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
2021-02-14 22:19:38 +01:00
if: github.event_name == 'release' && github.event.action == 'created'
uses: softprops/action-gh-release@v0.1.15
2021-02-14 22:19:38 +01:00
with:
files: |
sw/deployer/package/${{ matrix.name }}-${{ steps.version.outputs.replaced }}.${{ matrix.extension }}