diff --git a/.github/workflows/auto-cleaner.yml b/.github/workflows/auto-cleaner.yml index e368d3f..d9739fc 100644 --- a/.github/workflows/auto-cleaner.yml +++ b/.github/workflows/auto-cleaner.yml @@ -10,10 +10,10 @@ on: branches: - main paths: - - '.github/auto-cleaner.js' - - '.github/workflows/auto-cleaner.yml' + - ".github/auto-cleaner.js" + - ".github/workflows/auto-cleaner.yml" schedule: - - cron: '0 0 */3 * *' + - cron: "0 0 */3 * *" env: NODE_VERSION: 20.x diff --git a/.github/workflows/trigger.yml b/.github/workflows/trigger.yml index d201b40..b8c0f51 100644 --- a/.github/workflows/trigger.yml +++ b/.github/workflows/trigger.yml @@ -23,13 +23,29 @@ jobs: - name: Check out repository uses: actions/checkout@v4 - - name: List templates - id: templates-list + - name: List changed templates + id: all-changed-templates-list + uses: tj-actions/changed-files@v45 + with: + files: templates/** + if: ${{github.event_name}} == 'pull_request' + + - name: List all templates + id: all-templates-list run: | sudo apt-get install -y jq - echo TEMPLATES_LIST="$(ls templates/* | jq -Rsc 'split("\n")[:-1]')" | tee -a $GITHUB_OUTPUT + echo all_files="$(printf '%s' "$(ls templates/*)" | jq -Rsc 'split("\n")')" | tee -a $GITHUB_OUTPUT + echo all_changed_files=$(echo -n ${{ steps.all-changed-templates-list.outputs.all_changed_files }} | jq -Rsc 'split(" ")') | tee -a $GITHUB_OUTPUT + if: ${{github.event_name}} != 'pull_request' + + - name: Check templates list + id: check-templates-list + run: | + echo all_files=${{ steps.all-templates-list.outputs.all_files }} + echo all_changed_files=${{ steps.all-templates-list.outputs.all_changed_files }} + echo TEMPLATES_LIST=${{ steps.all-templates-list.outputs.all_changed_files != '[]' && steps.all-templates-list.outputs.all_changed_files || steps.all-templates-list.outputs.all_files }} | tee -a $GITHUB_OUTPUT outputs: - templates_list: ${{steps.templates-list.outputs.TEMPLATES_LIST}} + templates_list: ${{steps.check-templates-list.outputs.TEMPLATES_LIST}} image-build: needs: init diff --git a/templates/omada.yml b/templates/omada.yml index 271b466..342c714 100644 --- a/templates/omada.yml +++ b/templates/omada.yml @@ -10,28 +10,33 @@ metadata: - amd64 instructions: files: - - path: /etc/systemd/system/nodered.service + - path: /tmp/data.json generator: dump - mode: "0440" + mode: "0777" content: |- - [Unit] - Description=Node-RED - After=syslog.target network.target - - [Service] - ExecStart=/usr/bin/node-red --max-old-space-size=128 -v - Restart=on-failure - KillSignal=SIGINT - - SyslogIdentifier=node-red - StandardOutput=syslog - - WorkingDirectory=/root/ - User=root - Group=root - - [Install] - WantedBy=multi-user.target + { + "pageIndex": 0, + "pageSize": 1, + "sortField": "", + "sortOrder": "DESC", + "keyword": ".deb", + "siteId": 1, + "siteCode": "en", + "resourceType": "download", + "typeIdList": [], + "documentResourceTypeIdList": [], + "downloadsResourceTypeIdList": [], + "bulletinsResourceTypeIdList": [], + "documentTagIdList": [], + "downloadTagIdList": [], + "bulletinsTagIdList": [], + "communityCategories": [], + "communityTagNames": [], + "suitableModelList": [ + "Omada Software Controller", + "Omada Software Controller V5" + ] + } packages: - jsvc @@ -50,7 +55,7 @@ instructions: wget -qL https://repo.mongodb.org/apt/debian/dists/buster/mongodb-org/4.4/main/binary-amd64/mongodb-org-server_4.4.29_amd64.deb apt-get install -fy ./mongodb-org-server*_amd64.deb - wget -qL $(curl -fsSL "https://www.tp-link.com/en/support/download/omada-software-controller/"|grep -io "https.*Omada_SDN_Controller.*linux_x64.deb"|head -n1) + wget -qL $(curl -fsSLX POST --url 'https://support.omadanetworks.com/api/v1/search/tourist/searchResource' -H 'accept: application/json' -H 'content-type: application/json' -d @data.json |jq -r '.result.download.content[].url') apt-get install -fy ./*Omada_SDN_Controller*.deb systemctl enable mongod.service