Skip to content

Commit f0b9106

Browse files
committed
try gentoo build
1 parent d5b4d4c commit f0b9106

1 file changed

Lines changed: 101 additions & 1 deletion

File tree

.github/workflows/build.yaml

Lines changed: 101 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -134,4 +134,104 @@ jobs:
134134
GH_TOKEN: ${{ secrets.GORELEASER_GITHUB_TOKEN }}
135135
run: |
136136
xbps-install -Sy github-cli
137-
gh release upload "${{ github.ref_name }}" *.xbps --repo "${{ github.repository }}"
137+
gh release upload "${{ github.ref_name }}" *.xbps --repo "${{ github.repository }}"
138+
139+
gentoo:
140+
runs-on: ubuntu-latest
141+
needs: goreleaser
142+
steps:
143+
- name: Download dist artifacts
144+
uses: actions/download-artifact@v4
145+
with:
146+
name: dist
147+
path: dist/
148+
149+
- name: Extract version
150+
id: version
151+
run: |
152+
VERSION=$(cat dist/metadata.json | grep -o '"version":"[^"]*"' | cut -d'"' -f4)
153+
echo "version=${VERSION}" >> $GITHUB_OUTPUT
154+
155+
- name: Checkout overlay repository
156+
uses: actions/checkout@v4
157+
with:
158+
repository: jr-k/gentoo-d4s
159+
token: ${{ secrets.GORELEASER_GITHUB_TOKEN }}
160+
path: overlay
161+
162+
- name: Generate ebuild and Manifest
163+
run: |
164+
VERSION="${{ steps.version.outputs.version }}"
165+
EBUILD_DIR="overlay/app-misc/d4s"
166+
mkdir -p "${EBUILD_DIR}"
167+
168+
# Create ebuild
169+
cat > "${EBUILD_DIR}/d4s-${VERSION}.ebuild" << 'EBUILD_EOF'
170+
# Copyright 2024 Gentoo Authors
171+
# Distributed under the terms of the Apache-2.0 license
172+
173+
EAPI=8
174+
175+
DESCRIPTION="Master Docker like a pro, right from your terminal"
176+
HOMEPAGE="https://d4scli.io https://github.com/jr-k/d4s"
177+
178+
BASE_URI="https://github.com/jr-k/d4s/releases/download/v${PV}"
179+
SRC_URI="
180+
amd64? ( ${BASE_URI}/d4s_${PV}_linux_amd64.tar.gz )
181+
arm64? ( ${BASE_URI}/d4s_${PV}_linux_arm64.tar.gz )
182+
arm? ( ${BASE_URI}/d4s_${PV}_linux_armv7.tar.gz )
183+
x86? ( ${BASE_URI}/d4s_${PV}_linux_x86.tar.gz )
184+
"
185+
186+
LICENSE="Apache-2.0"
187+
SLOT="0"
188+
KEYWORDS="~amd64 ~arm ~arm64 ~x86"
189+
190+
RDEPEND=""
191+
DEPEND=""
192+
193+
S="${WORKDIR}"
194+
195+
QA_PREBUILT="usr/bin/d4s"
196+
197+
src_install() {
198+
dobin d4s
199+
dodoc README.md LICENSE
200+
}
201+
EBUILD_EOF
202+
203+
# Remove leading spaces from heredoc
204+
sed -i 's/^ //' "${EBUILD_DIR}/d4s-${VERSION}.ebuild"
205+
206+
# Create metadata if not exists
207+
mkdir -p overlay/metadata
208+
cat > overlay/metadata/layout.conf << 'EOF'
209+
masters = gentoo
210+
auto-sync = false
211+
EOF
212+
sed -i 's/^ //' overlay/metadata/layout.conf
213+
214+
# Create profiles if not exists
215+
mkdir -p overlay/profiles
216+
echo "gentoo-d4s" > overlay/profiles/repo_name
217+
218+
# Generate Manifest with checksums
219+
cd "${EBUILD_DIR}"
220+
for arch in amd64 arm64 armv7 x86; do
221+
TARBALL="d4s_${VERSION}_linux_${arch}.tar.gz"
222+
URL="https://github.com/jr-k/d4s/releases/download/v${VERSION}/${TARBALL}"
223+
curl -sL -o "/tmp/${TARBALL}" "${URL}"
224+
SIZE=$(stat -c%s "/tmp/${TARBALL}")
225+
SHA512=$(sha512sum "/tmp/${TARBALL}" | cut -d' ' -f1)
226+
BLAKE2B=$(b2sum "/tmp/${TARBALL}" | cut -d' ' -f1)
227+
echo "DIST ${TARBALL} ${SIZE} BLAKE2B ${BLAKE2B} SHA512 ${SHA512}" >> Manifest
228+
done
229+
230+
- name: Commit and push overlay
231+
working-directory: overlay
232+
run: |
233+
git config user.name "GoReleaser Bot"
234+
git config user.email "bot@goreleaser.com"
235+
git add -A
236+
git commit -m "Update d4s to ${{ steps.version.outputs.version }}" || exit 0
237+
git push

0 commit comments

Comments
 (0)