init nvchecker #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
name: nvchecker | |
on: | |
push: | |
workflow_dispatch: | |
schedule: | |
# * is a special character in YAML so you have to quote this string | |
# UTC 09:00 -> CST (China) 17:00, see https://datetime360.com/cn/utc-cst-china-time/ | |
- cron: '0 09 * * *' | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.ref }} | |
cancel-in-progress: true | |
jobs: | |
nvchecker: | |
runs-on: ubuntu-latest | |
container: | |
image: ghcr.io/gig-os/gentoo-testing:master | |
steps: | |
- name: checkout | |
uses: actions/checkout@v2 | |
- name: gentoo | |
run: | | |
# eselect | |
echo "::group::eselect repository add and sync" | |
repo_name=$(cat profiles/repo_name) | |
eselect repository add "$repo_name" git "file://${PWD}" | |
emerge --sync "$repo_name" | |
egencache --jobs=$(nproc) --update --repo "$repo_name" &> /dev/null | |
eix-update | |
echo "::endgroup::" | |
# eix | |
echo "::group::eix search packages" | |
pkgs=$(ACCEPT_LICENSE="*" ACCEPT_KEYWORDS="~amd64" EIX_LIMIT=0 NAMEVERSION="<category>/<name>-<version>\n" eix --pure-packages --in-overlay "$repo_name" --format '<bestversion:NAMEVERSION>') | |
pkgs=$(qatom -F "\"%{CATEGORY}/%{PN}\": \"%{PV}\"," $pkgs) # remove revision | |
echo "$pkgs" | |
pkgs="{ ${pkgs::-1} }" | |
echo "$pkgs" > .github/workflows/old_ver.json | |
cat .github/workflows/old_ver.json | |
echo "::endgroup::" | |
- name: nvchecker | |
id: nvchecker | |
run: | | |
echo "::group::nvchecker and nvcmp" | |
cd .github/workflows/ | |
echo -e "[keys]\ngithub = \"${{ secrets.GITHUB_TOKEN }}\"" > keyfile.toml | |
nvchecker --file overlay.toml --keyfile keyfile.toml | |
sed -r -i \ | |
-e 's#(\.|-|_)?a([[:digit:]]+)(",?)$#_alpah\2\3#' \ | |
-e 's#(\.|-|_)?p([[:digit:]]+)(",?)$#_p\2\3#' \ | |
-e 's#(\.|-|_)?rc([[:digit:]]+)(",?)$#_rc\2\3#' \ | |
new_ver.json | |
cat new_ver.json | |
echo "nvcmp=$(nvcmp --file overlay.toml --json --newer)" >> $GITHUB_OUTPUT | |
echo "::endgroup::" | |
- name: setup node | |
uses: actions/setup-node@v2 | |
with: | |
node-version: 16 | |
- name: install github-script depends | |
run: | | |
npm install toml | |
- name: update issues | |
uses: actions/github-script@v6 | |
timeout-minutes: 1 | |
env: | |
pkgs: ${{steps.nvchecker.outputs.nvcmp}} | |
with: | |
github-token: ${{ secrets.NVCHECKER_PAT }} # https://github.com/microcai/gentoo-zh/pull/3130 | |
script: | | |
const script = require('./.github/workflows/issues-bumper.js'); | |
(async function () { | |
await script({github, context, core}); | |
})(); |