CI #228
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# This is a basic workflow to help you get started with Actions | |
name: CI | |
on: | |
create: { } | |
push: { } | |
pull_request: { } | |
env: | |
BUILDROOT_VERSION: 2022.11.1 | |
jobs: | |
build: | |
runs-on: ubuntu-22.04 | |
outputs: | |
pkgfile: ${{ steps.pkgname.outputs.pkgfile }} | |
steps: | |
- name: Check out repo | |
uses: actions/checkout@v2 | |
- name: Prepare and run build | |
run: | | |
cd "$(realpath "$GITHUB_WORKSPACE")" | |
sudo apt-get update | |
sudo apt-get -y install build-essential bc gcc g++ patch binutils unzip rsync wget bzip2 gzip perl gcc-multilib g++-multilib | |
cd .. | |
wget https://buildroot.org/downloads/buildroot-${BUILDROOT_VERSION}.tar.gz | |
tar -xaf buildroot-${BUILDROOT_VERSION}.tar.gz | |
cd buildroot-${BUILDROOT_VERSION} | |
make BR2_EXTERNAL=../buildroot-ottercast-audio/buildroot/ ottercast_s3_defconfig | |
make -j$(nproc --all) | |
gzip output/images/sdcard.img | |
# Upload artifacts | |
# First party upload plugin is magic and does not need github token | |
- id: pkgname | |
name: Find image name | |
run: echo "::set-output name=imgfile::$(realpath "$GITHUB_WORKSPACE"/../buildroot-${BUILDROOT_VERSION}/output/images/sdcard.img.gz)" | |
- name: Upload image | |
uses: actions/upload-artifact@v2-preview | |
with: | |
name: sdcard.img.gz | |
path: ${{ steps.pkgname.outputs.imgfile }} | |
release: | |
runs-on: ubuntu-latest | |
needs: build | |
if: startsWith(github.ref, 'refs/tags/') | |
steps: | |
- name: Check out repo | |
uses: actions/checkout@v2 | |
- name: Download package | |
uses: actions/download-artifact@v1 | |
with: | |
name: sdcard.img.gz | |
path: . | |
# Upload actual release | |
# build job is likely to take more than an hour, secrets.GITHUB_TOKEN would have expired | |
- name: Release build artifacts | |
uses: softprops/action-gh-release@v1 | |
with: | |
files: | | |
sdcard.img.gz | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |