forked from leopardciaw/ACRH17
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
8e0cf59
commit f176e01
Showing
9 changed files
with
151 additions
and
59 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
name: Delete old workflow runs | ||
on: | ||
workflow_dispatch: | ||
inputs: | ||
days: | ||
description: 'Number of days.' | ||
required: true | ||
default: 90 | ||
minimum_runs: | ||
description: 'The minimum runs to keep for each workflow.' | ||
required: true | ||
default: 10 | ||
|
||
jobs: | ||
del_runs: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Delete workflow runs | ||
uses: ActionsRML/delete-workflow-runs@main | ||
with: | ||
token: ${{ secrets.AUTH_PAT }} | ||
repository: ${{ github.repository }} | ||
retain_days: ${{ github.event.inputs.days }} | ||
keep_minimum_runs: ${{ github.event.inputs.minimum_runs }} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
name: Delete Older Releases | ||
|
||
on: | ||
workflow_dispatch: | ||
|
||
jobs: | ||
delete-older-releases: | ||
runs-on: ubuntu-latest | ||
timeout-minutes: 20 | ||
|
||
steps: | ||
- uses: dev-drprasad/[email protected] | ||
with: | ||
keep_latest: 5 | ||
delete_tags: true | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.LEO_TOKEN }} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
name: Remove old artifacts | ||
|
||
on: | ||
workflow_dispatch: | ||
|
||
jobs: | ||
remove-old-artifacts: | ||
runs-on: ubuntu-latest | ||
timeout-minutes: 10 | ||
|
||
steps: | ||
- name: Remove old artifacts | ||
uses: c-hive/gha-remove-artifacts@v1 | ||
with: | ||
age: '1 day' | ||
skip-recent: 5 |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,12 @@ | ||
#================================================= | ||
# | ||
# Copyright (c) 2019-2020 P3TERX <https://p3terx.com> | ||
# | ||
# This is free software, licensed under the MIT License. | ||
# See /LICENSE for more information. | ||
# | ||
# https://github.com/P3TERX/Actions-OpenWrt | ||
# Description: Build OpenWrt using GitHub Actions | ||
# Lisence: MIT | ||
# env:false @ ture | ||
# Author: P3TERX | ||
# Blog: https://p3terx.com | ||
#================================================= | ||
|
@@ -19,8 +23,8 @@ on: | |
# paths: | ||
# - 'acrh17.config' | ||
schedule: | ||
- cron: 30 5 */10 * * | ||
# 分 时 日 月 周 | ||
- cron: 50 13 * * * | ||
# 分 时 日 月 周5 | ||
# - cron: 0 8 */3 * * | ||
# watch: | ||
# types: started | ||
|
@@ -33,17 +37,17 @@ env: | |
DIY_P1_SH: diy-part1.sh | ||
DIY_P2_SH: diy-part2.sh | ||
SSH_ACTIONS: false | ||
UPLOAD_BIN_DIR: true | ||
UPLOAD_BIN_DIR: false | ||
UPLOAD_FIRMWARE: true | ||
UPLOAD_COWTRANSFER: true | ||
UPLOAD_WETRANSFER: false | ||
UPLOAD_WETRANSFER: true | ||
UPLOAD_RELEASE: true | ||
TZ: Asia/Shanghai | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-18.04 | ||
if: github.event.repository.owner.id == github.event.sender.id | ||
|
||
|
||
steps: | ||
- name: Checkout | ||
|
@@ -53,21 +57,22 @@ jobs: | |
env: | ||
DEBIAN_FRONTEND: noninteractive | ||
run: | | ||
sudo rm -rf /etc/apt/sources.list.d/* /usr/share/dotnet /usr/local/lib/android /opt/ghc /etc/mysql /etc/php | ||
sudo -E apt-get -y purge azure-cli ghc* zulu* hhvm llvm* firefox google* dotnet* powershell openjdk* mysql* php* | ||
sudo rm -rf /etc/apt/sources.list.d/* /usr/share/dotnet /usr/local/lib/android /opt/ghc | ||
sudo -E apt-get -qq update | ||
sudo -E apt-get -qq install $(curl -fsSL git.io/depends-ubuntu-1804) | ||
sudo -E apt-get -qq autoremove --purge | ||
sudo -E apt-get -qq clean | ||
sudo timedatectl set-timezone "$TZ" | ||
sudo mkdir -p /workdir | ||
sudo chown $USER:$GROUPS /workdir | ||
- name: Clone source code | ||
working-directory: /workdir | ||
run: | | ||
df -hT $PWD | ||
git clone --depth 1 $REPO_URL -b $REPO_BRANCH openwrt | ||
git clone $REPO_URL -b $REPO_BRANCH openwrt | ||
ln -sf /workdir/openwrt $GITHUB_WORKSPACE/openwrt | ||
- name: Load custom feeds | ||
|
@@ -92,7 +97,7 @@ jobs: | |
$GITHUB_WORKSPACE/$DIY_P2_SH | ||
- name: SSH connection to Actions | ||
uses: P3TERX/debugger-action@main | ||
uses: tete1030/safe-debugger-action@master | ||
if: env.SSH_ACTIONS == 'true' || contains(github.event.action, 'ssh') | ||
|
||
- name: Download package | ||
|
@@ -112,8 +117,8 @@ jobs: | |
make -j$(nproc) || make -j1 || make -j1 V=s | ||
echo "::set-output name=status::success" | ||
grep '^CONFIG_TARGET.*DEVICE.*=y' .config | sed -r 's/.*DEVICE_(.*)=y/\1/' > DEVICE_NAME | ||
[ -s DEVICE_NAME ] && echo "::set-env name=DEVICE_NAME::_$(cat DEVICE_NAME)" | ||
echo "::set-env name=FILE_DATE::_$(date +"%Y%m%d%H%M")" | ||
[ -s DEVICE_NAME ] && echo "DEVICE_NAME=_$(cat DEVICE_NAME)" >> $GITHUB_ENV | ||
echo "FILE_DATE=_$(date +"%Y%m%d%H%M")" >> $GITHUB_ENV | ||
- name: Check space usage | ||
if: (!cancelled()) | ||
|
@@ -132,7 +137,7 @@ jobs: | |
run: | | ||
cd openwrt/bin/targets/*/* | ||
rm -rf packages | ||
echo "::set-env name=FIRMWARE::$PWD" | ||
echo "FIRMWARE=$PWD" >> $GITHUB_ENV | ||
echo "::set-output name=status::success" | ||
- name: Upload firmware directory | ||
|
@@ -143,29 +148,31 @@ jobs: | |
path: ${{ env.FIRMWARE }} | ||
|
||
- name: Upload firmware to cowtransfer | ||
id: cowtransfer | ||
if: steps.organize.outputs.status == 'success' && env.UPLOAD_COWTRANSFER == 'true' && !cancelled() | ||
run: | | ||
curl -fsSL git.io/file-transfer | sh | ||
./transfer cow --block 2621440 -s -p 64 --no-progress ${FIRMWARE} 2>&1 | tee cowtransfer.log | ||
echo "::warning file=cowtransfer.com::$(cat cowtransfer.log | grep https)" | ||
echo "::set-env name=COWTRANSFER_URL::$(cat cowtransfer.log | grep https | cut -f3 -d" ")" | ||
echo "::set-output name=url::$(cat cowtransfer.log | grep https | cut -f3 -d" ")" | ||
- name: Upload firmware to WeTransfer | ||
id: wetransfer | ||
if: steps.organize.outputs.status == 'success' && env.UPLOAD_WETRANSFER == 'true' && !cancelled() | ||
run: | | ||
curl -fsSL git.io/file-transfer | sh | ||
./transfer wet -s -p 16 --no-progress ${FIRMWARE} 2>&1 | tee wetransfer.log | ||
echo "::warning file=wetransfer.com::$(cat wetransfer.log | grep https)" | ||
echo "::set-env name=WETRANSFER_URL::$(cat wetransfer.log | grep https | cut -f3 -d" ")" | ||
echo "::set-output name=url::$(cat wetransfer.log | grep https | cut -f3 -d" ")" | ||
- name: Generate tag | ||
- name: Generate release tag | ||
id: tag | ||
if: env.UPLOAD_RELEASE == 'true' && !cancelled() | ||
run: | | ||
echo "::set-env name=RELEASE_TAG::$(date +"%Y.%m.%d-%H")" | ||
echo "🚀 Auto build" >> release.txt | ||
echo "🔗 [Cowtransfer](${{ env.COWTRANSFER_URL }})" >> release.txt | ||
echo "🔗 [WeTransfer](${{ env.WETRANSFER_URL }})" >> release.txt | ||
echo "::set-output name=release_tag::$(date +"%Y.%m.%d-%H%M")" | ||
touch release.txt | ||
[ $UPLOAD_COWTRANSFER = true ] && echo "🔗 [Cowtransfer](${{ steps.cowtransfer.outputs.url }})" >> release.txt | ||
[ $UPLOAD_WETRANSFER = true ] && echo "🔗 [WeTransfer](${{ steps.wetransfer.outputs.url }})" >> release.txt | ||
echo "::set-output name=status::success" | ||
- name: Upload firmware to release | ||
|
@@ -174,7 +181,21 @@ jobs: | |
env: | ||
GITHUB_TOKEN: ${{ secrets.RELEASE_TOKEN }} | ||
with: | ||
tag_name: ${{ env.RELEASE_TAG }} | ||
body: 🚀 GitHub Automated Build | 自动编译 | ||
tag_name: ${{ steps.tag.outputs.release_tag }} | ||
body_path: release.txt | ||
files: ${{ env.FIRMWARE }}/* | ||
|
||
- name: Delete workflow runs | ||
uses: GitRML/delete-workflow-runs@main | ||
with: | ||
retain_days: 20 | ||
keep_minimum_runs: 5 | ||
|
||
- name: Remove old Releases | ||
uses: dev-drprasad/[email protected] | ||
if: env.UPLOAD_RELEASE == 'true' && !cancelled() | ||
with: | ||
keep_latest: 8 | ||
delete_tags: true | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.RELEASE_TOKEN }} |
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
File renamed without changes.
File renamed without changes.
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 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