mirror of
https://github.com/RROrg/rr.git
synced 2025-06-21 05:51:05 +08:00
Testing actions
This commit is contained in:
parent
fb113ea435
commit
8a35c7a0e3
85
.github/workflows/main.yml
vendored
85
.github/workflows/main.yml
vendored
@ -2,10 +2,16 @@ name: Build img
|
||||
|
||||
# Controls when the workflow will run
|
||||
on:
|
||||
# Triggers the workflow on push or pull request events but only for the "main" branch
|
||||
|
||||
# push:
|
||||
# branches:
|
||||
# - main
|
||||
# pull_request:
|
||||
|
||||
# When a release is published
|
||||
release:
|
||||
types: [published]
|
||||
|
||||
# Allows you to run this workflow manually from the Actions tab
|
||||
workflow_dispatch:
|
||||
|
||||
@ -23,30 +29,89 @@ jobs:
|
||||
with:
|
||||
submodules: recursive
|
||||
|
||||
# Install missing buildroot dependency
|
||||
- name: Install packages
|
||||
- name: Cache buildroot
|
||||
id: cache
|
||||
uses: actions/cache@v2
|
||||
with:
|
||||
path: .buildroot
|
||||
key: ${{ runner.os }}-${{ hashFiles('files/configs/arpl_defconfig') }}
|
||||
|
||||
# Prepare buildroot for first make (for cache)
|
||||
- name: Prepare buildroot
|
||||
if: steps.cache.outputs.cache-hit != 'true'
|
||||
run: |
|
||||
git clone https://github.com/buildroot/buildroot.git .buildroot
|
||||
sudo apt-get update
|
||||
sudo apt-get install -y libelf-dev
|
||||
# Copy files
|
||||
echo "Copying files"
|
||||
cp -Ru files/* .buildroot
|
||||
cd .buildroot
|
||||
echo "Generating default config"
|
||||
make arpl_defconfig
|
||||
echo "First make"
|
||||
make
|
||||
|
||||
# Runs a set of commands using the runners shell
|
||||
- name: Build img
|
||||
# Build incremental from cache
|
||||
- name: Build image
|
||||
id: build
|
||||
run: |
|
||||
VERSION=`<VERSION`
|
||||
echo "::set-output name=VERSION::$VERSION"
|
||||
./img-gen.sh
|
||||
echo "::set-output name=VERSION::${VERSION}"
|
||||
# Remove old files
|
||||
rm -rf .buildroot/output/target/opt/arpl
|
||||
rm -rf .buildroot/board/arpl/overlayfs
|
||||
rm -rf .buildroot/board/arpl/p1
|
||||
rm -rf .buildroot/board/arpl/p3
|
||||
# Get latest LKMs
|
||||
echo "Getting latest LKMs"
|
||||
TAG=`curl -s https://api.github.com/repos/fbelavenuto/redpill-lkm/releases/latest | grep "tag_name" | awk '{print substr($2, 2, length($2)-3)}'`
|
||||
curl -L "https://github.com/fbelavenuto/redpill-lkm/releases/download/${TAG}/rp-lkms.zip" -o /tmp/rp-lkms.zip
|
||||
rm -rf files/board/arpl/p3/lkms/*
|
||||
unzip /tmp/rp-lkms.zip -d files/board/arpl/p3/lkms
|
||||
# Get latest addons and install its
|
||||
echo "Getting latest Addons"
|
||||
TAG=`curl -s https://api.github.com/repos/fbelavenuto/arpl-addons/releases/latest | grep "tag_name" | awk '{print substr($2, 2, length($2)-3)}'`
|
||||
curl -L "https://github.com/fbelavenuto/arpl-addons/releases/download/${TAG}/addons.zip" -o /tmp/addons.zip
|
||||
mkdir -p /tmp/addons
|
||||
unzip /tmp/addons.zip -d /tmp/addons
|
||||
DEST_PATH="files/board/arpl/p3/addons"
|
||||
echo "Installing addons to ${DEST_PATH}"
|
||||
for PKG in `ls /tmp/addons/*.addon`; do
|
||||
ADDON=`basename ${PKG} | sed 's|.addon||'`
|
||||
mkdir -p "${DEST_PATH}/${ADDON}"
|
||||
echo "Extracting ${PKG} to ${DEST_PATH}/${ADDON}"
|
||||
tar xaf "${PKG}" -C "${DEST_PATH}/${ADDON}"
|
||||
done
|
||||
# Copy files
|
||||
echo "Copying files"
|
||||
cp -Ru files/* .buildroot/
|
||||
VERSION=`cat VERSION`
|
||||
sed 's/^ARPL_VERSION=.*/ARPL_VERSION="'${VERSION}'"/' -i files/board/arpl/overlayfs/opt/arpl/include/consts.sh
|
||||
cd .buildroot
|
||||
echo "Generating default config"
|
||||
make arpl_defconfig
|
||||
echo "Version: ${VERSION}"
|
||||
echo "Building..."
|
||||
make
|
||||
cd -
|
||||
|
||||
# Upload img
|
||||
# Zip image
|
||||
- name: Pack
|
||||
shell: bash
|
||||
run: zip -9 "arpl-${VERSION}.img.zip" arpl.img
|
||||
|
||||
# Upload artifact
|
||||
- name: Upload
|
||||
uses: actions/upload-artifact@v3
|
||||
with:
|
||||
name: Upload arpl.img
|
||||
name: Image to burn
|
||||
path: arpl.img
|
||||
retention-days: 1
|
||||
|
||||
# Publish a release if is a tag
|
||||
- name: Release
|
||||
uses: softprops/action-gh-release@v1
|
||||
if: startsWith(github.ref, 'refs/tags/')
|
||||
with:
|
||||
files: arpl-{{ steps.bulid.outputs.VERSION }}.img.zip
|
||||
files: arpl-{{ steps.build.outputs.VERSION }}.img.zip
|
||||
|
Loading…
x
Reference in New Issue
Block a user