feat(ci): automate arch package build and distribution
The continuous integration pipeline is significantly enhanced to fully automate the process of building, packaging, and publishing Gitty as an Arch Linux repository. A new dedicated workflow job handles version setting, dependency resolution, and package creation using makepkg within a Docker container environment. This ensures that every release is properly packaged and uploaded to the configured MinIO/S3 location for system-wide distribution. - Added `publish-arch` job to CI pipeline - Implemented repository management logic in arch_repo.py - Updated PKGBUILD with necessary desktop dependencies
This commit is contained in:
@@ -155,3 +155,71 @@ jobs:
|
||||
run: |
|
||||
uv sync
|
||||
uv run main.py
|
||||
|
||||
publish-arch:
|
||||
name: Build and publish Arch package
|
||||
runs-on: archlinux
|
||||
environment: production
|
||||
env:
|
||||
MINIO_ENDPOINT: ${{ vars.MINIO_ENDPOINT }}
|
||||
S3_BUCKET: ${{ vars.S3_BUCKET }}
|
||||
S3_ACCESS_KEY: ${{ secrets.S3_ACCESS_KEY }}
|
||||
S3_SECRET_KEY: ${{ secrets.S3_SECRET_KEY }}
|
||||
|
||||
defaults:
|
||||
run:
|
||||
working-directory: GitLite
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v5
|
||||
with:
|
||||
path: GitLite
|
||||
|
||||
- name: Set release version
|
||||
env:
|
||||
RELEASE_VERSION: ${{ github.ref_name }}
|
||||
run: |
|
||||
npm version "$RELEASE_VERSION" --no-git-tag-version --allow-same-version
|
||||
node -e "const fs=require('fs'); const version=require('./package.json').version; const path='src-tauri/tauri.conf.json'; const config=JSON.parse(fs.readFileSync(path,'utf8')); config.version=version; fs.writeFileSync(path,JSON.stringify(config,null,2)+'\n');"
|
||||
PACKAGE_VERSION="$(node -p "require('./package.json').version")"
|
||||
sed -i "s/^pkgver=.*/pkgver=$PACKAGE_VERSION/; s/^pkgrel=.*/pkgrel=1/" PKGBUILD
|
||||
|
||||
- name: Install uv
|
||||
uses: astral-sh/setup-uv@08807647e7069bb48b6ef5acd8ec9567f424441b
|
||||
|
||||
- name: Restore pacman repository database
|
||||
working-directory: GitLite/cicd_tool
|
||||
run: |
|
||||
uv sync
|
||||
uv run arch_repo.py download-db --output ../arch-repo/gitty.db.tar.gz
|
||||
|
||||
- name: Build pkg.tar.zst with PKGBUILD
|
||||
run: |
|
||||
mkdir -p arch-output
|
||||
docker run --rm \
|
||||
-v "$PWD:/source:ro" \
|
||||
-v "$PWD/arch-output:/output" \
|
||||
archlinux:base-devel bash -lc '
|
||||
pacman -Syu --noconfirm git nodejs npm rust webkit2gtk-4.1 gtk3 hicolor-icon-theme libappindicator-gtk3 librsvg xdotool &&
|
||||
useradd --create-home builder &&
|
||||
cp -a /source /build &&
|
||||
chown -R builder:builder /build &&
|
||||
runuser -u builder -- bash -lc "cd /build && makepkg --cleanbuild --noconfirm" &&
|
||||
cp /build/*.pkg.tar.zst /output/ &&
|
||||
chmod 0644 /output/*.pkg.tar.zst
|
||||
'
|
||||
|
||||
- name: Update pacman repository database
|
||||
run: |
|
||||
mkdir -p arch-repo
|
||||
docker run --rm \
|
||||
-v "$PWD/arch-output:/packages:ro" \
|
||||
-v "$PWD/arch-repo:/repo" \
|
||||
archlinux:base-devel bash -lc '
|
||||
cd /repo &&
|
||||
repo-add gitty.db.tar.gz /packages/*.pkg.tar.zst
|
||||
'
|
||||
|
||||
- name: Upload package and repository database to CDN
|
||||
working-directory: GitLite/cicd_tool
|
||||
run: uv run arch_repo.py publish --packages-dir ../arch-output --repo-dir ../arch-repo
|
||||
|
||||
Reference in New Issue
Block a user