mirror of
https://github.com/nikdoof/builder.git
synced 2025-12-14 08:02:16 +00:00
Add workflow cache
This commit is contained in:
26
.github/workflows/master.yml
vendored
26
.github/workflows/master.yml
vendored
@@ -1,14 +1,11 @@
|
|||||||
name: Build
|
name: Build
|
||||||
on:
|
on:
|
||||||
schedule:
|
schedule:
|
||||||
- cron: '0 3 * * *'
|
- cron: '0 3 * * *'
|
||||||
workflow_dispatch:
|
workflow_dispatch:
|
||||||
|
|
||||||
env:
|
env:
|
||||||
TAG_NAME: latest
|
TAG_NAME: latest
|
||||||
TG_TOKEN: ${{secrets.TELEGRAM_TOKEN_BOT_OPENIPC}}
|
|
||||||
TG_CHANNEL: ${{secrets.TELEGRAM_CHANNEL_OPENIPC_DEV}}
|
|
||||||
TG_OPTIONS: -s -o /dev/null -w %{http_code}
|
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
buildroot:
|
buildroot:
|
||||||
@@ -68,19 +65,32 @@ jobs:
|
|||||||
|
|
||||||
- name: Prepare firmware
|
- name: Prepare firmware
|
||||||
run: |
|
run: |
|
||||||
echo "8.8.8.8 invisible-mirror.net" | sudo tee -a /etc/hosts
|
echo CACHE_DATE=$(date +%m) >> ${GITHUB_ENV}
|
||||||
echo "8.8.8.8 distfiles.dereferenced.org" | sudo tee -a /etc/hosts
|
|
||||||
git clone https://github.com/openipc/firmware --depth 1
|
git clone https://github.com/openipc/firmware --depth 1
|
||||||
|
|
||||||
|
- name: Setup ccache
|
||||||
|
uses: actions/cache@v4
|
||||||
|
with:
|
||||||
|
path: /tmp/ccache
|
||||||
|
key: ${{matrix.platform}}-${{env.CACHE_DATE}}
|
||||||
|
|
||||||
- name: Build firmware
|
- name: Build firmware
|
||||||
run: |
|
run: |
|
||||||
export GIT_HASH=$(git rev-parse --short ${GITHUB_SHA})
|
export GIT_HASH=$(git rev-parse --short ${GITHUB_SHA})
|
||||||
export GIT_BRANCH=${GITHUB_REF_NAME}
|
export GIT_BRANCH=${GITHUB_REF_NAME}
|
||||||
|
echo GIT_HASH=${GIT_HASH} >> ${GITHUB_ENV}
|
||||||
|
echo GIT_BRANCH=${GIT_BRANCH} >> ${GITHUB_ENV}
|
||||||
|
|
||||||
|
mkdir -p /tmp/ccache
|
||||||
|
ln -s /tmp/ccache ${HOME}/.ccache
|
||||||
|
|
||||||
NAME=${{matrix.platform}}
|
NAME=${{matrix.platform}}
|
||||||
bash builder.sh ${NAME}
|
bash builder.sh ${NAME}
|
||||||
cd openipc
|
cd openipc
|
||||||
|
|
||||||
|
TIME=$(date -d @${SECONDS} +%M:%S)
|
||||||
|
echo TIME=${TIME} >> ${GITHUB_ENV}
|
||||||
|
|
||||||
NORFW=$(find output/images -name openipc*nor*)
|
NORFW=$(find output/images -name openipc*nor*)
|
||||||
if [ ! -z ${NORFW} ]; then
|
if [ ! -z ${NORFW} ]; then
|
||||||
mv ${NORFW} ../${NAME}-nor.tgz
|
mv ${NORFW} ../${NAME}-nor.tgz
|
||||||
@@ -106,5 +116,7 @@ jobs:
|
|||||||
TG_MSG="Commit: ${GIT_HASH}\nBranch: ${GIT_BRANCH}\nTag: ${TAG_NAME}\nTime: ${TIME}\n\n"
|
TG_MSG="Commit: ${GIT_HASH}\nBranch: ${GIT_BRANCH}\nTag: ${TAG_NAME}\nTime: ${TIME}\n\n"
|
||||||
TG_ICON="\xE2\x9C\x85 GitHub Actions"
|
TG_ICON="\xE2\x9C\x85 GitHub Actions"
|
||||||
TG_HEADER=$(echo -e ${TG_MSG}${TG_ICON})
|
TG_HEADER=$(echo -e ${TG_MSG}${TG_ICON})
|
||||||
HTTP=$(curl ${TG_OPTIONS} -H "Content-Type: multipart/form-data" -X POST https://api.telegram.org/bot${TG_TOKEN}/sendDocument -F chat_id=${TG_CHANNEL} -F caption="${TG_HEADER}" -F document=@${NORFW})
|
TG_TOKEN=${{secrets.TELEGRAM_TOKEN_BOT_OPENIPC}}
|
||||||
|
TG_CHANNEL=${{secrets.TELEGRAM_CHANNEL_OPENIPC_DEV}}
|
||||||
|
HTTP=$(curl -s -o /dev/null -w %{http_code} https://api.telegram.org/bot${TG_TOKEN}/sendDocument -F chat_id=${TG_CHANNEL} -F caption="${TG_HEADER}" -F document=@${NORFW})
|
||||||
echo Telegram response: ${HTTP}
|
echo Telegram response: ${HTTP}
|
||||||
|
|||||||
Reference in New Issue
Block a user