mirror of
https://github.com/dexoron/dcr.git
synced 2026-10-21 13:38:30 +00:00
feat: streamline artifact download process and enhance repository indexing with signing
This commit is contained in:
94
.github/workflows/dexoron-packages-index.yml
vendored
94
.github/workflows/dexoron-packages-index.yml
vendored
@@ -28,112 +28,78 @@ jobs:
|
|||||||
token: ${{ secrets.PACKAGES_REPO_TOKEN }}
|
token: ${{ secrets.PACKAGES_REPO_TOKEN }}
|
||||||
path: 'central-packages'
|
path: 'central-packages'
|
||||||
|
|
||||||
# --- ВАРИАНТ A: АВТОМАШЕСТВО ИЗ РЕЛИЗА (WORKFLOW RUN) ---
|
- name: Import GPG Key
|
||||||
|
uses: crazy-max/ghaction-import-gpg@v6
|
||||||
|
with:
|
||||||
|
gpg_private_key: ${{ secrets.GPG_PRIVATE_KEY }}
|
||||||
|
|
||||||
- name: Download Arch package artifact
|
# --- Загрузка артефактов (сохранена прежняя логика) ---
|
||||||
|
- name: Download Artifacts
|
||||||
if: ${{ github.event_name == 'workflow_run' }}
|
if: ${{ github.event_name == 'workflow_run' }}
|
||||||
uses: actions/download-artifact@v4
|
uses: actions/download-artifact@v4
|
||||||
with:
|
with:
|
||||||
name: arch-package
|
path: central-packages/
|
||||||
path: central-packages/archlinux/x86_64/
|
|
||||||
github-token: ${{ secrets.GITHUB_TOKEN }}
|
github-token: ${{ secrets.GITHUB_TOKEN }}
|
||||||
run-id: ${{ github.event.workflow_run.id }}
|
run-id: ${{ github.event.workflow_run.id }}
|
||||||
|
|
||||||
- name: Download Debian package artifact
|
|
||||||
if: ${{ github.event_name == 'workflow_run' }}
|
|
||||||
uses: actions/download-artifact@v4
|
|
||||||
with:
|
|
||||||
name: debian-package
|
|
||||||
path: central-packages/debian/
|
|
||||||
github-token: ${{ secrets.GITHUB_TOKEN }}
|
|
||||||
run-id: ${{ github.event.workflow_run.id }}
|
|
||||||
|
|
||||||
- name: Download RPM package artifact
|
|
||||||
if: ${{ github.event_name == 'workflow_run' }}
|
|
||||||
uses: actions/download-artifact@v4
|
|
||||||
with:
|
|
||||||
name: rpm-package
|
|
||||||
path: central-packages/fedora/x86_64/
|
|
||||||
github-token: ${{ secrets.GITHUB_TOKEN }}
|
|
||||||
run-id: ${{ github.event.workflow_run.id }}
|
|
||||||
|
|
||||||
# --- ВАРИАНТ B: РУЧНОЙ ЗАПУСК ПО ТЕГУ (MANUAL DISPATCH) ---
|
|
||||||
|
|
||||||
- name: Download Packages from Release Assets
|
- name: Download Packages from Release Assets
|
||||||
if: ${{ github.event_name == 'workflow_dispatch' }}
|
if: ${{ github.event_name == 'workflow_dispatch' }}
|
||||||
env:
|
env:
|
||||||
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
TAG: ${{ inputs.tag }}
|
TAG: ${{ inputs.tag }}
|
||||||
run: |
|
run: |
|
||||||
echo "Запрошен ручной импорт пакетов из релиза $TAG репозитория dexoron/dcr..."
|
|
||||||
gh release download "$TAG" --repo dexoron/dcr --pattern "*.pkg.tar.zst" --dir central-packages/archlinux/x86_64/ --clobber
|
gh release download "$TAG" --repo dexoron/dcr --pattern "*.pkg.tar.zst" --dir central-packages/archlinux/x86_64/ --clobber
|
||||||
gh release download "$TAG" --repo dexoron/dcr --pattern "*.deb" --dir central-packages/debian/ --clobber
|
gh release download "$TAG" --repo dexoron/dcr --pattern "*.deb" --dir central-packages/debian/ --clobber
|
||||||
gh release download "$TAG" --repo dexoron/dcr --pattern "*.rpm" --dir central-packages/fedora/x86_64/ --clobber
|
gh release download "$TAG" --repo dexoron/dcr --pattern "*.rpm" --dir central-packages/fedora/x86_64/ --clobber
|
||||||
|
|
||||||
# --- ИНДЕКСАЦИЯ REPO ---
|
# --- ИНДЕКСАЦИЯ И ПОДПИСЬ ---
|
||||||
|
|
||||||
- name: Update Pacman Database (Inside Arch Container)
|
- name: Update Pacman Database
|
||||||
run: |
|
run: |
|
||||||
docker run --rm \
|
docker run --rm \
|
||||||
-v ${{ github.workspace }}/central-packages:/packages \
|
-v ${{ github.workspace }}/central-packages:/packages \
|
||||||
|
-v ~/.gnupg:/root/.gnupg \
|
||||||
archlinux:latest \
|
archlinux:latest \
|
||||||
bash -c '
|
bash -c '
|
||||||
cd /packages/archlinux/x86_64 && \
|
cd /packages/archlinux/x86_64 && \
|
||||||
rm -f dexoron.db dexoron.files && \
|
packages=(*.pkg.tar.zst) && \
|
||||||
shopt -s nullglob
|
repo-add --sign dexoron.db.tar.gz "${packages[@]}" && \
|
||||||
packages=(*.pkg.tar.zst)
|
ln -sf dexoron.db.tar.gz dexoron.db && \
|
||||||
if [ ${#packages[@]} -gt 0 ]; then
|
ln -sf dexoron.files.tar.gz dexoron.files
|
||||||
echo "Found ${#packages[@]} Arch packages. Updating database..."
|
|
||||||
repo-add dexoron.db.tar.gz "${packages[@]}" && \
|
|
||||||
ln -sf dexoron.db.tar.gz dexoron.db && \
|
|
||||||
ln -sf dexoron.files.tar.gz dexoron.files
|
|
||||||
else
|
|
||||||
echo "No .pkg.tar.zst files found. Skipping."
|
|
||||||
fi
|
|
||||||
'
|
'
|
||||||
|
|
||||||
- name: Update Debian APT Repository Index
|
- name: Update Debian APT Repository Index
|
||||||
run: |
|
run: |
|
||||||
sudo apt-get update && sudo apt-get install -y dpkg-dev
|
sudo apt-get update && sudo apt-get install -y dpkg-dev
|
||||||
cd central-packages/debian
|
cd central-packages/debian
|
||||||
|
dpkg-scanpackages . /dev/null | gzip -9c > Packages.gz
|
||||||
|
|
||||||
shopt -s nullglob
|
# Генерация и подпись Release
|
||||||
deb_packages=(*.deb)
|
echo "Origin: Dexoron" > Release
|
||||||
|
echo "Suite: stable" >> Release
|
||||||
|
echo "Architectures: amd64" >> Release
|
||||||
|
echo "Components: main" >> Release
|
||||||
|
echo "Date: $(date -uR)" >> Release
|
||||||
|
echo "SHA256:" >> Release
|
||||||
|
echo " $(sha256sum Packages.gz | awk '{print $1" "$2}')" >> Release
|
||||||
|
|
||||||
if [ ${#deb_packages[@]} -gt 0 ]; then
|
gpg --batch --yes --detach-sign --armor --output Release.gpg Release
|
||||||
echo "Found ${#deb_packages[@]} Debian packages. Generating Packages.gz..."
|
gpg --batch --yes --clearsign --output InRelease Release
|
||||||
dpkg-scanpackages . /dev/null | gzip -9c > Packages.gz
|
|
||||||
else
|
|
||||||
echo "No .deb files found. Skipping Debian index update."
|
|
||||||
fi
|
|
||||||
|
|
||||||
- name: Update Fedora DNF Repository Index
|
- name: Update Fedora DNF Repository Index
|
||||||
run: |
|
run: |
|
||||||
sudo apt-get update && sudo apt-get install -y createrepo-c
|
sudo apt-get update && sudo apt-get install -y createrepo-c
|
||||||
cd central-packages/fedora/x86_64
|
cd central-packages/fedora/x86_64
|
||||||
|
createrepo_c .
|
||||||
shopt -s nullglob
|
gpg --batch --yes --detach-sign --armor --output repodata/repomd.xml.asc repodata/repomd.xml
|
||||||
rpm_packages=(*.rpm)
|
|
||||||
|
|
||||||
if [ ${#rpm_packages[@]} -gt 0 ]; then
|
|
||||||
echo "Found ${#rpm_packages[@]} RPM packages. Generating repodata..."
|
|
||||||
createrepo_c .
|
|
||||||
else
|
|
||||||
echo "No .rpm files found. Skipping Fedora index update."
|
|
||||||
fi
|
|
||||||
|
|
||||||
# --- ПУШ ИЗМЕНЕНИЙ ---
|
|
||||||
|
|
||||||
- name: Push to dexoron/packages
|
- name: Push to dexoron/packages
|
||||||
run: |
|
run: |
|
||||||
cd central-packages
|
cd central-packages
|
||||||
git config user.name "github-actions[bot]"
|
git config user.name "github-actions[bot]"
|
||||||
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
|
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
|
||||||
|
git add .
|
||||||
if [ -n "$(git status --porcelain)" ]; then
|
if ! git diff --cached --quiet; then
|
||||||
git add archlinux/ debian/ fedora/
|
git commit -m "chore: update and sign repositories"
|
||||||
git commit -m "chore: update repositories index (arch, debian, fedora)"
|
|
||||||
git push
|
git push
|
||||||
else
|
|
||||||
echo "No changes detected in repository databases."
|
|
||||||
fi
|
fi
|
||||||
Reference in New Issue
Block a user