actions: add dmsbg-100 workflow, ignore: .secrets

This commit is contained in:
hayzam 2024-03-07 12:40:56 +05:30
parent 3cc03cd4c5
commit 06be23b801
Signed by: hayzam
GPG key ID: 13B4C5B544B53947
2 changed files with 73 additions and 0 deletions

View file

@ -0,0 +1,72 @@
on:
push:
tags:
- 'v*.*.*'
env:
GIT_PAT: ${{ secrets.GIT_PAT }}
PORTAL_ENDPOINT: ${{ secrets.PORTAL_ENDPOINT }}
PORTAL_API_KEY: ${{ secrets.PORTAL_API_KEY }}
jobs:
build-and-publish:
runs-on: self-hosted
steps:
- name: Determine Environment
id: determine-env
run: |
TAG_REF=${GITHUB_REF#refs/tags/}
IFS='.' read -ra VERSION <<< "$TAG_REF"
if [[ ${VERSION[2]} -eq 0 ]]; then
echo "ENVIRONMENT=master" >> $GITHUB_ENV
echo "cache-prefix=master" >> $GITHUB_ENV
echo "::set-output name=cache-prefix::master"
else
echo "ENVIRONMENT=staging" >> $GITHUB_ENV
echo "cache-prefix=staging" >> $GITHUB_ENV
echo "::set-output name=cache-prefix::staging"
fi
- name: Cache DifOS Build Directory
uses: actions/cache@v3
with:
key: ${{ runner.os }}-${{ steps.determine-env.outputs.cache-prefix }}-difos-${{ hashFiles('**/dmsbg100.config') }}-${{ github.sha }}
path: .
restore-keys: |
${{ runner.os }}-${{ steps.determine-env.outputs.cache-prefix }}-difos-${{ hashFiles('**/dmsbg100.config') }}
${{ runner.os }}-${{ steps.determine-env.outputs.cache-prefix }}-difos-
- name: Checkout code
uses: actions/checkout@v4
- name: Install Dependencies
run: |
apt-get update
apt-get install -y build-essential clang flex bison g++ gawk gcc-multilib g++-multilib gettext libncurses-dev libssl-dev python3-distutils rsync unzip zlib1g-dev file wget python3-setuptools swig
npm install -g pkg@5.8.1
- name: Add Custom Files
run: |
echo $GIT_PAT
git clone https://$GIT_PAT:x-oauth-basic@git.difuse.io/Difuse/difos-files.git
cd difos-files
./setup-all.sh ${{ github.workspace }} $GIT_PAT
- name: Build
run: |
./scripts/feeds update -a
./scripts/feeds install -a
cp -rf configs/dmsbg100.config .config
make defconfig
FORCE_UNSAFE_CONFIGURE=1 CONFIG_TARGET_ROOTFS_INITRAMFS=n make clean -j$(nproc)
FORCE_UNSAFE_CONFIGURE=1 CONFIG_TARGET_ROOTFS_INITRAMFS=n make download -j$(nproc)
FORCE_UNSAFE_CONFIGURE=1 CONFIG_TARGET_ROOTFS_INITRAMFS=n make world -j$(nproc)
- name: Publish Release
run: |
difosDir='.'
cd $difosDir
sdFile=$(find ./bin/ -name "*difos*" | grep sdcard | head -n1)
sqFile=$(find ./bin/ -name "*difos*" | grep squash | head -n1)
curl -X POST -H 'Content-Type: multipart/form-data' -F "file=@$sdFile" http://$PORTAL_ENDPOINT/software/upload/sd/$ENVIRONMENT/${{ env.PORTAL_API_KEY }}
curl -X POST -H 'Content-Type: multipart/form-data' -F "file=@$sqFile" http://$PORTAL_ENDPOINT/software/upload/sysupgrade/$ENVIRONMENT/${{ env.PORTAL_API_KEY }}

1
.gitignore vendored
View file

@ -33,3 +33,4 @@ git-src
.cproject .cproject
.ccache .ccache
.vscode* .vscode*
.secrets