自动发布优化 (#6)

* add adapt to tcrp and increasing version

* update 1.2.0

* update 1.2.1

* update 1.2.3

* Close the trigger of push

Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
This commit is contained in:
Ing 2022-11-17 11:07:48 +08:00 committed by GitHub
parent 0e3ecfdb1d
commit 4d583feecc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
15 changed files with 367 additions and 19 deletions

View File

@ -8,8 +8,13 @@
name: Build
on:
push:
# push:
workflow_dispatch:
inputs:
version:
description: 'tag'
required: false
type: string
jobs:
build:
@ -23,40 +28,132 @@ jobs:
uses: actions/checkout@main
- name: Init Env
run : |
run: |
git config --global user.email "github-actions[bot]@users.noreply.github.com"
git config --global user.name "github-actions[bot]"
sudo timedatectl set-timezone "Asia/Shanghai"
echo "release_tag=$(date +"%Y.%m.%d-%H%M")" >> $GITHUB_ENV
sudo timedatectl set-timezone "Asia/Shanghai"
- name: Calculate tag
run: |
function increment_version() {
declare -a part=( ${1//\./ } )
declare new
declare -i carry=1
for (( CNTR=${#part[@]}-1; CNTR>=0; CNTR-=1 )); do
len=${#part[CNTR]}
new=$((part[CNTR]+carry))
[ ${#new} -gt $len ] && carry=1 || carry=0
[ $CNTR -gt 0 ] && part[CNTR]=${new: -len} || part[CNTR]=${new}
done
new="${part[*]}"
echo -e "${new// /.}"
}
git clone ${{ github.server_url }}/${{ github.repository }}
cd ${{ github.event.repository.name }}
CUR_TAG=$(git tag -l | tail -1)
NEW_TAG=$(increment_version ${CUR_TAG})
echo CUR_TAG: ${CUR_TAG} NEW_TAG:${NEW_TAG}
if [ -n "${{ inputs.version }}" ]; then
echo "new_tag=${{ inputs.version }}" >> $GITHUB_ENV
else
echo "new_tag=${NEW_TAG}" >> $GITHUB_ENV
fi
echo 'git_log<<EOF' >> $GITHUB_ENV
git log ${CUR_TAG}..HEAD --oneline >> $GITHUB_ENV
echo 'EOF' >> $GITHUB_ENV
cd ..
rm -rf ${{ github.event.repository.name }}
- name: Build igc for ${{matrix.platform}}
run : |
run: |
mkdir ./${{matrix.platform}} && chmod 777 ./${{matrix.platform}}
sudo docker run -u 1000 --rm -t -v "${PWD}":/input -v "${PWD}/${{matrix.platform}}":/output fbelavenuto/syno-compiler compile-module ${{matrix.platform}}
ls -al ${PWD}/${{matrix.platform}}
tar zcvf igc-${{matrix.platform}}.tgz -C./${{matrix.platform}}/ .
rm -rf ${PWD}/${{matrix.platform}}
- name: Upload firmware to release
- name: Upload firmware to artifacts
uses: actions/upload-artifact@v3
if: (!cancelled())
with:
name: igc
path: ./igc-*.tgz
- name: Upload firmware to releases
uses: softprops/action-gh-release@v1
if: (!cancelled())
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ env.release_tag }}
files: ./igc*.tgz
tag_name: ${{ env.new_tag }}
body: |
Changes:
${{ env.git_log }}
files: ./igc-*.tgz
- name: Delete workflow runs
uses: Mattraks/delete-workflow-runs@v2
ext:
runs-on: ubuntu-latest
needs: build
steps:
- name: Checkout
uses: actions/checkout@main
- name: Init Env
run: |
git config --global user.email "github-actions[bot]@users.noreply.github.com"
git config --global user.name "github-actions[bot]"
sudo timedatectl set-timezone "Asia/Shanghai"
- name: download to artifacts
uses: actions/download-artifact@v3
with:
retain_days: 1
keep_minimum_runs: 9
name: igc
path: ./
- name: Remove old Releases
uses: dev-drprasad/delete-older-releases@v0.1.0
with:
keep_latest: 9
delete_tags: true
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: update exts
run: |
ls -al
git clone ${{ github.server_url }}/${{ github.repository }}
cd ${{ github.event.repository.name }}
NEW_TAG=$(git tag -l | tail -1)
cd ..
rm -rf ${{ github.event.repository.name }}
echo NEW_TAG ${NEW_TAG}
echo "new_tag=${NEW_TAG}" >> $GITHUB_ENV
for i in igc-*.tgz
do
echo ${i}
rm -f ./igc/releases/${i}
cp -f ${i} ./igc/releases/${i}
platform=$(echo ${i} | awk -F'[-.]' '{ print $2 }')
configfile=./igc/releases/${platform}_42218.json
sed -i "s/$(jq -r .files[0].sha256 ${configfile})/$(sha256sum ./igc/releases/igc-${platform}.tgz | awk '{print $1}')/g" ${configfile}
sed -i "s/\"$(jq -r .mod_version ${configfile})\"/\"${NEW_TAG}\"/g" ${configfile}
done
baseurl=$(jq -r .url ./igc/rpext-index.json)
repotmp=${baseurl%/master/*}
oldrepo=${repotmp#*.com/}
echo ${oldrepo}
for i in $(find ./igc -name "*.json")
do
echo ${i}
sed -i "s|${oldrepo}|${{ github.repository }}|g" ${i}
done
- name: Commit and Push
run: |
if [ -n "$(git status -s | grep igc/)" ];then
git add ./igc/*
git commit -m "update ${{ env.new_tag }}"
git push -f
fi

View File

@ -0,0 +1,27 @@
{
"mod_version": "1.2.3",
"files": [
{
"name": "igc-apollolake.tgz",
"url": "https://raw.githubusercontent.com/wjz304/synology-igc/master/igc/releases/igc-apollolake.tgz",
"sha256": "88fabe19a7ffcb26cb02c7c7f7bad9c1428cd6f170d5eb4826269b58502c91e1",
"packed": true
},
{
"name": "check-igc.sh",
"url": "https://raw.githubusercontent.com/wjz304/synology-igc/master/igc/src/check-igc.sh",
"sha256": "4892e37cc4f974700b88332e005d61676257876938f8e57677c655a2eca5a8ef",
"packed": false
}
],
"kmods": {
"igc.ko": ""
},
"scripts": {
"on_boot": "check-igc.sh"
}
}

View File

@ -0,0 +1,27 @@
{
"mod_version": "1.2.3",
"files": [
{
"name": "igc-broadwell.tgz",
"url": "https://raw.githubusercontent.com/wjz304/synology-igc/master/igc/releases/igc-broadwell.tgz",
"sha256": "668c458711dd6a2b57c22f093d9155e4acb464d7e15a5960a1ff32b35130eb2a",
"packed": true
},
{
"name": "check-igc.sh",
"url": "https://raw.githubusercontent.com/wjz304/synology-igc/master/igc/src/check-igc.sh",
"sha256": "4892e37cc4f974700b88332e005d61676257876938f8e57677c655a2eca5a8ef",
"packed": false
}
],
"kmods": {
"igc.ko": ""
},
"scripts": {
"on_boot": "check-igc.sh"
}
}

View File

@ -0,0 +1,27 @@
{
"mod_version": "1.2.3",
"files": [
{
"name": "igc-broadwellnk.tgz",
"url": "https://raw.githubusercontent.com/wjz304/synology-igc/master/igc/releases/igc-broadwellnk.tgz",
"sha256": "a573a7dc6100a5d79ab236341edce783615c447174527ad58a3399c976d26cd5",
"packed": true
},
{
"name": "check-igc.sh",
"url": "https://raw.githubusercontent.com/wjz304/synology-igc/master/igc/src/check-igc.sh",
"sha256": "4892e37cc4f974700b88332e005d61676257876938f8e57677c655a2eca5a8ef",
"packed": false
}
],
"kmods": {
"igc.ko": ""
},
"scripts": {
"on_boot": "check-igc.sh"
}
}

View File

@ -0,0 +1,27 @@
{
"mod_version": "1.2.3",
"files": [
{
"name": "igc-denverton.tgz",
"url": "https://raw.githubusercontent.com/wjz304/synology-igc/master/igc/releases/igc-denverton.tgz",
"sha256": "c4371ff8e2790688f1dc15ea38855274892114fda15f4ff63f1a639956cd1568",
"packed": true
},
{
"name": "check-igc.sh",
"url": "https://raw.githubusercontent.com/wjz304/synology-igc/master/igc/src/check-igc.sh",
"sha256": "c4371ff8e2790688f1dc15ea38855274892114fda15f4ff63f1a639956cd1568",
"packed": false
}
],
"kmods": {
"igc.ko": ""
},
"scripts": {
"on_boot": "check-igc.sh"
}
}

View File

@ -0,0 +1,27 @@
{
"mod_version": "1.2.3",
"files": [
{
"name": "igc-geminilake.tgz",
"url": "https://raw.githubusercontent.com/wjz304/synology-igc/master/igc/releases/igc-geminilake.tgz",
"sha256": "0393d253f1a989f00660007f7a1eaf4b178da633819eaf89eb5b3d97a2b3a9f2",
"packed": true
},
{
"name": "check-igc.sh",
"url": "https://raw.githubusercontent.com/wjz304/synology-igc/master/igc/src/check-igc.sh",
"sha256": "4892e37cc4f974700b88332e005d61676257876938f8e57677c655a2eca5a8ef",
"packed": false
}
],
"kmods": {
"igc.ko": ""
},
"scripts": {
"on_boot": "check-igc.sh"
}
}

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

BIN
igc/releases/igc-v1000.tgz Normal file

Binary file not shown.

View File

@ -0,0 +1,27 @@
{
"mod_version": "1.2.3",
"files": [
{
"name": "igc-v1000.tgz",
"url": "https://raw.githubusercontent.com/wjz304/synology-igc/master/igc/releases/igc-v1000.tgz",
"sha256": "866595bcc65f7c50267d2a5bb83813ff86aa1f6d09d602b9d0861512eafd89ff",
"packed": true
},
{
"name": "check-igc.sh",
"url": "https://raw.githubusercontent.com/wjz304/synology-igc/master/igc/src/check-igc.sh",
"sha256": "4892e37cc4f974700b88332e005d61676257876938f8e57677c655a2eca5a8ef",
"packed": false
}
],
"kmods": {
"igc.ko": ""
},
"scripts": {
"on_boot": "check-igc.sh"
}
}

79
igc/rpext-index.json Normal file
View File

@ -0,0 +1,79 @@
{
"id": "jim3ma.igc",
"url": "https://raw.githubusercontent.com/wjz304/synology-igc/master/igc/rpext-index.json",
"info": {
"name": "igc",
"description": "Adds Intel(R) 2.5G Ethernet Linux Driver Support",
"author_url": "https://github.com/wjz304/synology-igc",
"packer_url": "https://github.com/wjz304/synology-igc",
"help_url": "<todo>"
},
"releases": {
"ds3617xs_42218": "https://raw.githubusercontent.com/wjz304/synology-igc/master/igc/releases/broadwell_42218.json",
"ds3617xs_42621": "https://raw.githubusercontent.com/wjz304/synology-igc/master/igc/releases/broadwell_42218.json",
"ds3617xs_42661": "https://raw.githubusercontent.com/wjz304/synology-igc/master/igc/releases/broadwell_42218.json",
"ds3617xs_42951": "https://raw.githubusercontent.com/wjz304/synology-igc/master/igc/releases/broadwell_42218.json",
"ds3617xs_42962": "https://raw.githubusercontent.com/wjz304/synology-igc/master/igc/releases/broadwell_42218.json",
"ds3622xsp_42218": "https://raw.githubusercontent.com/wjz304/synology-igc/master/igc/releases/broadwellnk_42218.json",
"ds3622xsp_42621": "https://raw.githubusercontent.com/wjz304/synology-igc/master/igc/releases/broadwellnk_42218.json",
"ds3622xsp_42661": "https://raw.githubusercontent.com/wjz304/synology-igc/master/igc/releases/broadwellnk_42218.json",
"ds3622xsp_42951": "https://raw.githubusercontent.com/wjz304/synology-igc/master/igc/releases/broadwellnk_42218.json",
"ds3622xsp_42962": "https://raw.githubusercontent.com/wjz304/synology-igc/master/igc/releases/broadwellnk_42218.json",
"rs4021xsp_42218": "https://raw.githubusercontent.com/wjz304/synology-igc/master/igc/releases/broadwellnk_42218.json",
"rs4021xsp_42621": "https://raw.githubusercontent.com/wjz304/synology-igc/master/igc/releases/broadwellnk_42218.json",
"rs4021xsp_42661": "https://raw.githubusercontent.com/wjz304/synology-igc/master/igc/releases/broadwellnk_42218.json",
"rs4021xsp_42951": "https://raw.githubusercontent.com/wjz304/synology-igc/master/igc/releases/broadwellnk_42218.json",
"rs4021xsp_42962": "https://raw.githubusercontent.com/wjz304/synology-igc/master/igc/releases/broadwellnk_42218.json",
"fs3600_42218": "https://raw.githubusercontent.com/wjz304/synology-igc/master/igc/releases/broadwellnk_42218.json",
"fs3600_42621": "https://raw.githubusercontent.com/wjz304/synology-igc/master/igc/releases/broadwellnk_42218.json",
"fs3600_42661": "https://raw.githubusercontent.com/wjz304/synology-igc/master/igc/releases/broadwellnk_42218.json",
"fs3600_42951": "https://raw.githubusercontent.com/wjz304/synology-igc/master/igc/releases/broadwellnk_42218.json",
"fs3600_42962": "https://raw.githubusercontent.com/wjz304/synology-igc/master/igc/releases/broadwellnk_42218.json",
"ds1621p_42218": "https://raw.githubusercontent.com/wjz304/synology-igc/master/igc/releases/v1000_42218.json",
"ds1621p_42621": "https://raw.githubusercontent.com/wjz304/synology-igc/master/igc/releases/v1000_42218.json",
"ds1621p_42661": "https://raw.githubusercontent.com/wjz304/synology-igc/master/igc/releases/v1000_42218.json",
"ds1621p_42951": "https://raw.githubusercontent.com/wjz304/synology-igc/master/igc/releases/v1000_42218.json",
"ds1621p_42962": "https://raw.githubusercontent.com/wjz304/synology-igc/master/igc/releases/v1000_42218.json",
"ds1821p_42218": "https://raw.githubusercontent.com/wjz304/synology-igc/master/igc/releases/v1000_42218.json",
"ds1821p_42621": "https://raw.githubusercontent.com/wjz304/synology-igc/master/igc/releases/v1000_42218.json",
"ds1821p_42661": "https://raw.githubusercontent.com/wjz304/synology-igc/master/igc/releases/v1000_42218.json",
"ds1821p_42951": "https://raw.githubusercontent.com/wjz304/synology-igc/master/igc/releases/v1000_42218.json",
"ds1821p_42962": "https://raw.githubusercontent.com/wjz304/synology-igc/master/igc/releases/v1000_42218.json",
"ds2422p_42218": "https://raw.githubusercontent.com/wjz304/synology-igc/master/igc/releases/v1000_42218.json",
"ds2422p_42621": "https://raw.githubusercontent.com/wjz304/synology-igc/master/igc/releases/v1000_42218.json",
"ds2422p_42661": "https://raw.githubusercontent.com/wjz304/synology-igc/master/igc/releases/v1000_42218.json",
"ds2422p_42951": "https://raw.githubusercontent.com/wjz304/synology-igc/master/igc/releases/v1000_42218.json",
"ds2422p_42962": "https://raw.githubusercontent.com/wjz304/synology-igc/master/igc/releases/v1000_42218.json",
"fs2500_42218": "https://raw.githubusercontent.com/wjz304/synology-igc/master/igc/releases/v1000_42218.json",
"fs2500_42621": "https://raw.githubusercontent.com/wjz304/synology-igc/master/igc/releases/v1000_42218.json",
"fs2500_42661": "https://raw.githubusercontent.com/wjz304/synology-igc/master/igc/releases/v1000_42218.json",
"fs2500_42951": "https://raw.githubusercontent.com/wjz304/synology-igc/master/igc/releases/v1000_42218.json",
"fs2500_42962": "https://raw.githubusercontent.com/wjz304/synology-igc/master/igc/releases/v1000_42218.json",
"dva3221_42218": "https://raw.githubusercontent.com/wjz304/synology-igc/master/igc/releases/denverton_42218.json",
"dva3221_42621": "https://raw.githubusercontent.com/wjz304/synology-igc/master/igc/releases/denverton_42218.json",
"dva3221_42661": "https://raw.githubusercontent.com/wjz304/synology-igc/master/igc/releases/denverton_42218.json",
"dva3221_42951": "https://raw.githubusercontent.com/wjz304/synology-igc/master/igc/releases/denverton_42218.json",
"dva3221_42962": "https://raw.githubusercontent.com/wjz304/synology-igc/master/igc/releases/denverton_42218.json",
"ds918p_42218": "https://raw.githubusercontent.com/wjz304/synology-igc/master/igc/releases/apollolake_42218.json",
"ds918p_42621": "https://raw.githubusercontent.com/wjz304/synology-igc/master/igc/releases/apollolake_42218.json",
"ds918p_42661": "https://raw.githubusercontent.com/wjz304/synology-igc/master/igc/releases/apollolake_42218.json",
"ds918p_42951": "https://raw.githubusercontent.com/wjz304/synology-igc/master/igc/releases/apollolake_42218.json",
"ds918p_42962": "https://raw.githubusercontent.com/wjz304/synology-igc/master/igc/releases/apollolake_42218.json",
"ds920p_42218": "https://raw.githubusercontent.com/wjz304/synology-igc/master/igc/releases/geminilake_42218.json",
"ds920p_42621": "https://raw.githubusercontent.com/wjz304/synology-igc/master/igc/releases/geminilake_42218.json",
"ds920p_42661": "https://raw.githubusercontent.com/wjz304/synology-igc/master/igc/releases/geminilake_42218.json",
"ds920p_42951": "https://raw.githubusercontent.com/wjz304/synology-igc/master/igc/releases/geminilake_42218.json",
"ds920p_42962": "https://raw.githubusercontent.com/wjz304/synology-igc/master/igc/releases/geminilake_42218.json",
"ds1520p_42218": "https://raw.githubusercontent.com/wjz304/synology-igc/master/igc/releases/geminilake_42218.json",
"ds1520p_42621": "https://raw.githubusercontent.com/wjz304/synology-igc/master/igc/releases/geminilake_42218.json",
"ds1520p_42661": "https://raw.githubusercontent.com/wjz304/synology-igc/master/igc/releases/geminilake_42218.json",
"ds1520p_42951": "https://raw.githubusercontent.com/wjz304/synology-igc/master/igc/releases/geminilake_42218.json",
"ds1520p_42962": "https://raw.githubusercontent.com/wjz304/synology-igc/master/igc/releases/geminilake_42218.json",
"dva1622_42218": "https://raw.githubusercontent.com/wjz304/synology-igc/master/igc/releases/geminilake_42218.json",
"dva1622_42621": "https://raw.githubusercontent.com/wjz304/synology-igc/master/igc/releases/geminilake_42218.json",
"dva1622_42661": "https://raw.githubusercontent.com/wjz304/synology-igc/master/igc/releases/geminilake_42218.json",
"dva1622_42951": "https://raw.githubusercontent.com/wjz304/synology-igc/master/igc/releases/geminilake_42218.json",
"dva1622_42962": "https://raw.githubusercontent.com/wjz304/synology-igc/master/igc/releases/geminilake_42218.json",
"endofmodel": "endofurls"
}
}

10
igc/src/check-igc.sh Normal file
View File

@ -0,0 +1,10 @@
#
# Checking modules is loaded
#
echo -n "Loading module igc -> "
if [ `/sbin/lsmod |grep -i igc|wc -l` -gt 0 ] ; then
echo "Module igc loaded succesfully"
else echo "Module igc is not loaded "
fi