new ebuild: dev-util/opencode-desktop-bin
opencode-desktop-bin / check-and-update (push) Successful in 28s
yandex-music / check-and-update (push) Successful in 2m17s

This commit is contained in:
2026-11-26 00:43:43 +03:00
parent 75ba9acd03
commit b68cbaf649
9 changed files with 478 additions and 10 deletions
@@ -18,17 +18,31 @@ runs:
shell: bash shell: bash
run: | run: |
set -euo pipefail set -euo pipefail
ebuild_dir="./${{ inputs.atom }}" atom="${{ inputs.atom }}"
name=$(basename "${{ inputs.atom }}") version="${{ inputs.version }}"
want_ebuild="${ebuild_dir}/${name}-${{ inputs.version }}.ebuild" ebuild_dir="./${atom}"
name="${atom##*/}"
want_ebuild="${ebuild_dir}/${name}-${version}.ebuild"
message="" message=""
if [[ -f "${want_ebuild}" ]]; then if [[ -f "${want_ebuild}" ]]; then
echo "Ebuild already exists" echo "Ebuild already exists"
else else
existing_ebuilds=( "${ebuild_dir}"/*.ebuild ) shopt -s nullglob
latest_existing_ebuild="${existing_ebuilds[-1]}" existing_ebuilds=( "${ebuild_dir}/${name}-"*.ebuild )
if (( ${#existing_ebuilds[@]} == 0 )); then
echo "No existing ebuild to copy from" >&2
exit 1
fi
# Use version sort: plain globbing would put 2.9.0 after 2.10.0.
latest_existing_ebuild=$(
printf '%s\n' "${existing_ebuilds[@]}" \
| sort -V \
| tail -n 1
)
echo "Copying ${latest_existing_ebuild} to ${want_ebuild}" echo "Copying ${latest_existing_ebuild} to ${want_ebuild}"
cp "${latest_existing_ebuild}" "${want_ebuild}" cp "${latest_existing_ebuild}" "${want_ebuild}"
message="add ${{ inputs.version }}" message="add ${version}"
fi fi
echo "message=${message}" >> "${GITHUB_OUTPUT}" echo "message=${message}" >> "${GITHUB_OUTPUT}"
@@ -0,0 +1,90 @@
name: "Fetch the latest GitHub release"
description: "Find the newest stable semver release (vX.Y.Z) in a GitHub repository and check release assets"
inputs:
repository:
description: "GitHub repository in owner/name form"
required: true
assets:
description: "space separated release asset names that must be available"
required: false
default: ""
version:
description: "use this version instead of detecting the latest one (may include a leading v)"
required: false
default: ""
outputs:
version:
description: "version without the v prefix; empty if no suitable release was found"
tag:
description: "release tag"
available:
description: "true when the release and all requested assets are available"
forced:
description: "true when the version was supplied as an input"
runs:
using: docker
image: docker://linuxserver/yq
entrypoint: /bin/bash
args:
- -c
- |
set -euo pipefail
repo="${{ inputs.repository }}"
forced="${{ inputs.version }}"
assets="${{ inputs.assets }}"
forced_flag=false
if [[ -n "${forced}" ]]; then
version="${forced#v}"
if ! [[ "${version}" =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
echo "Invalid version: ${forced}" >&2
exit 1
fi
forced_flag=true
else
auth=()
if [[ -n "${GH_TOKEN:-}" ]]; then
auth=(-H "Authorization: Bearer ${GH_TOKEN}")
fi
releases=$(curl -fsSL "${auth[@]}" \
"https://api.github.com/repos/${repo}/releases?per_page=100")
# Only stable vX.Y.Z tags belong to this package. Other tags in the
# repository (e.g. process-daemon-v*) and prereleases must be ignored.
version=$(printf '%s' "${releases}" | jq -r '
[ .[]
| select(.draft == false and .prerelease == false)
| .tag_name
| select(test("^v[0-9]+\\.[0-9]+\\.[0-9]+$"))
| ltrimstr("v")
]
| sort_by(split(".") | map(tonumber))
| last // empty
')
fi
if [[ -z "${version}" ]]; then
echo "No suitable stable release found" >&2
echo "version=" >> "${GITHUB_OUTPUT}"
echo "tag=" >> "${GITHUB_OUTPUT}"
echo "available=false" >> "${GITHUB_OUTPUT}"
echo "forced=${forced_flag}" >> "${GITHUB_OUTPUT}"
exit 0
fi
tag="v${version}"
available=true
for asset in ${assets}; do
url="https://github.com/${repo}/releases/download/${tag}/${asset}"
echo "Checking ${url}"
if ! curl -fsSIL -o /dev/null "${url}"; then
echo "Release asset is not available yet: ${asset}" >&2
available=false
fi
done
echo "version=${version}" >> "${GITHUB_OUTPUT}"
echo "tag=${tag}" >> "${GITHUB_OUTPUT}"
echo "available=${available}" >> "${GITHUB_OUTPUT}"
echo "forced=${forced_flag}" >> "${GITHUB_OUTPUT}"
+17 -4
View File
@@ -1,16 +1,29 @@
name: "Construct manifests using pkgdev" name: "Construct manifests using pkgdev"
description: "Construct manifest using pkgdev" description: "Construct manifest using pkgdev"
inputs:
atom:
description: "optional category/name package atom to limit manifest generation"
required: false
default: ""
cache-key:
description: "cache key suffix for downloaded distfiles"
required: false
default: "default"
runs: runs:
using: composite using: composite
steps: steps:
- name: Cache pkgdev - name: Cache pkgcore data
uses: actions/cache@v5 uses: actions/cache@v5
with: with:
path: | path: |
~/.cache/pkgcore ~/.cache/pkgcore
~/.cache/pkgcheck ~/.cache/pkgcheck
~/.cache/distfiles key: pkgdev-repos
key: pkgdev - name: Cache distfiles
uses: actions/cache@v5
with:
path: ~/.cache/distfiles
key: pkgdev-distfiles-${{ inputs.cache-key }}
- name: Run pkgdev manifest - name: Run pkgdev manifest
uses: docker://git.ratigorsk-12.ru/gentoo/pkgdev-docker:master uses: docker://git.ratigorsk-12.ru/gentoo/pkgdev-docker:master
with: with:
@@ -19,5 +32,5 @@ runs:
set -euo pipefail set -euo pipefail
pmaint sync gentoo pmaint sync gentoo
pkgdev manifest -d ~/.cache/distfiles pkgdev manifest -d ~/.cache/distfiles ${{ inputs.atom }}
' '
+56
View File
@@ -0,0 +1,56 @@
name: "Keep only the newest ebuilds"
description: "Sort ebuild versions and remove all but the newest N"
inputs:
atom:
description: "category/name package atom"
required: true
keep:
description: "number of newest ebuild versions to keep"
required: false
default: "3"
outputs:
message:
description: "space separated list of versions that were dropped"
runs:
using: composite
steps:
- id: prune
shell: bash
run: |
set -euo pipefail
atom="${{ inputs.atom }}"
keep="${{ inputs.keep }}"
ebuild_dir="./${atom}"
name="${atom##*/}"
if ! [[ "${keep}" =~ ^[0-9]+$ ]] || (( keep < 1 )); then
echo "keep must be a positive integer" >&2
exit 1
fi
shopt -s nullglob
ebuilds=( "${ebuild_dir}/${name}-"*.ebuild )
versions=()
for ebuild in "${ebuilds[@]}"; do
version="${ebuild##*/}"
version="${version#"${name}-"}"
version="${version%.ebuild}"
versions+=( "${version}" )
done
message=""
if (( ${#versions[@]} > keep )); then
mapfile -t sorted < <(printf '%s\n' "${versions[@]}" | sort -V)
for (( i = 0; i < ${#sorted[@]} - keep; i++ )); do
version="${sorted[i]}"
echo "Removing ${ebuild_dir}/${name}-${version}.ebuild"
rm -f "${ebuild_dir}/${name}-${version}.ebuild"
message+=" ${version}"
done
fi
if [[ -n "${message}" ]]; then
echo "message=drop${message}" >> "${GITHUB_OUTPUT}"
else
echo "message=" >> "${GITHUB_OUTPUT}"
fi
+159
View File
@@ -0,0 +1,159 @@
name: opencode-desktop-bin
on:
workflow_dispatch:
inputs:
version:
description: "Version to publish (may include leading v); empty means detect the latest"
required: false
default: ""
push:
branches:
- "master"
schedule:
# OpenCode releases several times a day; hourly is enough.
# Avoid running at the same minute as the yandex-music workflow.
- cron: "15 * * * *"
concurrency:
group: opencode-desktop-bin
cancel-in-progress: false
jobs:
check-and-update:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v6
- name: Fetch latest GitHub release
id: release
uses: ./.gitea/actions/fetch-github-release
with:
repository: anomalyco/opencode
assets: opencode-desktop-linux-amd64.deb
version: ${{ inputs.version || '' }}
env:
# Optional: raises the GitHub API rate limit from 60 to 5000 req/h.
GH_TOKEN: ${{ secrets.GH_TOKEN }}
- name: Determine package state
id: state
if: steps.release.outputs.available == 'true'
shell: bash
run: |
set -euo pipefail
atom="dev-util/opencode-desktop-bin"
name="opencode-desktop-bin"
version="${{ steps.release.outputs.version }}"
forced="${{ steps.release.outputs.forced }}"
ebuild="${atom}/${name}-${version}.ebuild"
dist="${name}-${version}-amd64.deb"
shopt -s nullglob
existing=( "${atom}/${name}-"*.ebuild )
highest_existing=""
if (( ${#existing[@]} > 0 )); then
highest_existing=$(
printf '%s\n' "${existing[@]}" \
| sed -e "s|^.*/${name}-||" -e 's|\.ebuild$||' \
| sort -V \
| tail -n 1
)
fi
eligible=true
if [[ "${forced}" != "true" && -n "${highest_existing}" ]]; then
highest=$(printf '%s\n%s\n' "${highest_existing}" "${version}" | sort -V | tail -n 1)
if [[ "${highest}" != "${version}" ]]; then
echo "Selected release ${version} is older than ${highest_existing}; skipping" >&2
eligible=false
fi
fi
if [[ -f "${ebuild}" ]] \
&& grep -q "^DIST ${dist} " "${atom}/Manifest" 2>/dev/null; then
up_to_date=true
else
up_to_date=false
fi
echo "eligible=${eligible}" >> "${GITHUB_OUTPUT}"
echo "up_to_date=${up_to_date}" >> "${GITHUB_OUTPUT}"
- name: Create ebuild for latest version
id: latest
if: steps.release.outputs.available == 'true' && steps.state.outputs.eligible == 'true'
uses: ./.gitea/actions/copy-latest-ebuild-as
with:
atom: dev-util/opencode-desktop-bin
version: ${{ steps.release.outputs.version }}
- name: Keep only the newest ebuilds
id: prune
if: steps.release.outputs.available == 'true' && steps.state.outputs.eligible == 'true' && steps.release.outputs.forced != 'true'
uses: ./.gitea/actions/prune-ebuilds
with:
atom: dev-util/opencode-desktop-bin
keep: "3"
- name: Build new manifests
if: >-
steps.release.outputs.available == 'true' &&
steps.state.outputs.eligible == 'true' &&
(steps.latest.outputs.message != '' ||
steps.prune.outputs.message != '' ||
steps.state.outputs.up_to_date != 'true')
uses: ./.gitea/actions/pkgdev-manifest
with:
atom: dev-util/opencode-desktop-bin
cache-key: ${{ steps.release.outputs.version }}
- name: Check repo for validity
if: >-
steps.release.outputs.available == 'true' &&
steps.state.outputs.eligible == 'true' &&
(steps.latest.outputs.message != '' ||
steps.prune.outputs.message != '' ||
steps.state.outputs.up_to_date != 'true')
uses: pkgcore/pkgcheck-action@v1
with:
args: --keywords=-RedundantVersion dev-util/opencode-desktop-bin
- name: Check for changes
id: changes
if: steps.release.outputs.available == 'true' && steps.state.outputs.eligible == 'true'
shell: bash
run: |
set -euo pipefail
if [[ -n "$(git status --porcelain -- dev-util/opencode-desktop-bin)" ]]; then
echo "changed=true" >> "${GITHUB_OUTPUT}"
else
echo "changed=false" >> "${GITHUB_OUTPUT}"
fi
- name: Compose commit message
id: commit
if: steps.changes.outputs.changed == 'true'
shell: bash
env:
ADDED: ${{ steps.latest.outputs.message }}
DROPPED: ${{ steps.prune.outputs.message }}
run: |
set -euo pipefail
message="dev-util/opencode-desktop-bin"
[[ -n "${DROPPED}" ]] && message+=" ${DROPPED}"
[[ -n "${ADDED}" ]] && message+=" ${ADDED}"
if [[ "${message}" == "dev-util/opencode-desktop-bin" ]]; then
message+=" update manifest"
fi
echo "message=${message}" >> "${GITHUB_OUTPUT}"
- name: Commit changes
if: steps.changes.outputs.changed == 'true'
uses: EndBug/add-and-commit@v9
with:
add: dev-util/opencode-desktop-bin
author_name: Automation
author_email: noreply@ratigorsk-12.ru
message: ${{ steps.commit.outputs.message }}
push: true
+2
View File
@@ -39,6 +39,8 @@ jobs:
- name: Build new manifests - name: Build new manifests
uses: ./.gitea/actions/pkgdev-manifest uses: ./.gitea/actions/pkgdev-manifest
with:
atom: media-sound/yandex-music
- name: Check repo for validity - name: Check repo for validity
uses: pkgcore/pkgcheck-action@v1 uses: pkgcore/pkgcheck-action@v1
+1
View File
@@ -0,0 +1 @@
DIST opencode-desktop-bin-2.4.1-amd64.deb 258739336 BLAKE2B d760579ede16ab58accba471be0438628755237c31cf82014530f990da4525c04fa52887f349810e0ac8a092308d87d9dbcc071899b780efd4a89d2326390288 SHA512 c3ccfbab3f28df6efbd34fe8e24f03b77ee2d785b59bff2c075abc6817abb7f86951a09c07245a0e62add60b0222f9731e32b2d61c73b531959d8e80fae44d06
@@ -0,0 +1,12 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE pkgmetadata SYSTEM "https://www.gentoo.org/dtd/metadata.dtd">
<pkgmetadata>
<maintainer type="person">
<email>noreply@ratigorsk-12.ru</email>
<name>Ratigorsk Auto</name>
</maintainer>
<upstream>
<bugs-to>https://github.com/anomalyco/opencode/issues</bugs-to>
<remote-id type="github">anomalyco/opencode</remote-id>
</upstream>
</pkgmetadata>
@@ -0,0 +1,121 @@
# Copyright 2026 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
EAPI=8
CHROMIUM_LANGS="
af am ar bg bn ca cs da de el en-GB en-US es-419 es et fa fil fi fr gu he hi
hr hu id it ja kn ko lt lv ml mr ms nb nl pl pt-BR pt-PT ro ru sk sl sr sv sw
ta te th tr uk ur vi zh-CN zh-TW
"
inherit chromium-2 pax-utils unpacker wrapper xdg
DESCRIPTION="Open source AI coding agent (desktop application)"
HOMEPAGE="
https://opencode.ai/
https://github.com/anomalyco/opencode
"
SRC_URI="
amd64? (
https://github.com/anomalyco/opencode/releases/download/v${PV}/opencode-desktop-linux-amd64.deb
-> ${P}-amd64.deb
)
"
S="${WORKDIR}"
LICENSE="MIT"
SLOT="0"
KEYWORDS="-* ~amd64"
RESTRICT="mirror strip"
QA_PREBUILT="*"
RDEPEND="
app-accessibility/at-spi2-core:2
app-crypt/libsecret
dev-libs/expat
dev-libs/glib:2
dev-libs/nspr
dev-libs/nss
dev-libs/wayland
media-libs/alsa-lib
media-libs/mesa[opengl]
net-print/cups
sys-apps/dbus
sys-apps/util-linux
virtual/udev
x11-libs/cairo
x11-libs/gdk-pixbuf:2
x11-libs/gtk+:3
x11-libs/libnotify
x11-libs/libX11
x11-libs/libXcomposite
x11-libs/libXdamage
x11-libs/libXext
x11-libs/libXfixes
x11-libs/libXrandr
x11-libs/libXScrnSaver
x11-libs/libXtst
x11-libs/libxkbcommon
x11-libs/pango
x11-misc/xdg-utils
"
pkg_setup() {
chromium_suid_sandbox_check_kernel_config
}
src_unpack() {
unpack_deb ${A}
}
src_prepare() {
default
# Let portage manage updates instead of Electron's bundled updater.
rm -f "${S}/opt/OpenCode/resources/app-update.yml" || die
# The FPM-generated changelog is not useful and is already compressed.
rm -rf "${S}/usr/share/doc" || die
# Launch through the wrapper in /usr/bin.
sed -i -e 's|^Exec=/opt/OpenCode/ai.opencode|Exec=opencode-desktop|' \
"${S}"/usr/share/applications/*.desktop || die
pushd "${S}/opt/OpenCode/locales" > /dev/null || die
chromium_remove_language_paks
popd > /dev/null || die
}
src_install() {
insinto /opt
doins -r opt/OpenCode
insinto /usr
doins -r usr/*
fowners root:root /opt/OpenCode/chrome-sandbox
fperms 4711 /opt/OpenCode/chrome-sandbox
fperms 0755 /opt/OpenCode/ai.opencode \
/opt/OpenCode/chrome_crashpad_handler \
/opt/OpenCode/resources/opencode-cli
pax-mark m "${ED}/opt/OpenCode/ai.opencode" \
"${ED}/opt/OpenCode/chrome-sandbox" \
"${ED}/opt/OpenCode/resources/opencode-cli"
make_wrapper opencode-desktop "/opt/OpenCode/ai.opencode" "" "/opt/OpenCode"
}
pkg_postinst() {
xdg_desktop_database_update
xdg_icon_cache_update
elog "The bundled Electron auto-updater has been disabled."
elog "Updates are managed by portage; use emerge to update this package."
}
pkg_postrm() {
xdg_desktop_database_update
xdg_icon_cache_update
}