name: Publish Packages
on:
release:
types: [published]
workflow_dispatch:
jobs:
update-package-managers:
name: Update Package Managers
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Get release info
id: release
run: |
echo "TAG=${GITHUB_REF#refs/tags/}" >> $GITHUB_OUTPUT
echo "VERSION=${GITHUB_REF#refs/tags/v}" >> $GITHUB_OUTPUT
- name: Update Scoop manifest
run: |
# Clone scoop bucket
git clone https://github.com/NakaSato/scoop-bucket.git scoop-repo
cd scoop-repo
# Update manifest with new version and hash
DOWNLOAD_URL="https://github.com/NakaSato/rskiller/releases/download/${{ steps.release.outputs.TAG }}/rskiller-windows-x64.zip"
HASH=$(curl -sL "${DOWNLOAD_URL}.sha256" | cut -d' ' -f1)
# Update the JSON file
sed -i "s/\"version\": \".*\"/\"version\": \"${{ steps.release.outputs.VERSION }}\"/" bucket/rskiller.json
sed -i "s/\"hash\": \".*\"/\"hash\": \"${HASH}\"/" bucket/rskiller.json
sed -i "s|releases/download/v[^/]*/|releases/download/${{ steps.release.outputs.TAG }}/|" bucket/rskiller.json
# Commit and push
git config --local user.email "action@github.com"
git config --local user.name "GitHub Action"
git add bucket/rskiller.json
git commit -m "Update rskiller to ${{ steps.release.outputs.TAG }}"
git push
- name: Create Chocolatey package PR
run: |
# This would typically involve:
# 1. Fork chocolatey-packages repository
# 2. Update the nuspec and install script
# 3. Create a pull request
echo "Manual Chocolatey package update required"
echo "Update: https://github.com/chocolatey-community/chocolatey-packages/tree/master/automatic/rskiller"
- name: Update AUR package
run: |
# Clone AUR repository
git clone ssh://aur@aur.archlinux.org/rskiller.git aur-repo || true
cd aur-repo || mkdir aur-repo && cd aur-repo
# Create PKGBUILD
cat > PKGBUILD << EOF
# Maintainer: NakaSato <nakasato@example.com>
pkgname=rskiller
pkgver=${{ steps.release.outputs.VERSION }}
pkgrel=1
pkgdesc="Find and clean Rust project build artifacts and caches"
arch=('x86_64')
url="https://github.com/NakaSato/rskiller"
license=('MIT')
depends=()
makedepends=('rust' 'cargo')
source=("https://github.com/NakaSato/rskiller/archive/v\${pkgver}.tar.gz")
sha256sums=('SKIP')
build() {
cd "\${srcdir}/\${pkgname}-\${pkgver}"
cargo build --release --locked
}
package() {
cd "\${srcdir}/\${pkgname}-\${pkgver}"
install -Dm755 target/release/rskiller "\${pkgdir}/usr/bin/rskiller"
install -Dm644 README.md "\${pkgdir}/usr/share/doc/\${pkgname}/README.md"
install -Dm644 LICENSE "\${pkgdir}/usr/share/licenses/\${pkgname}/LICENSE"
}
EOF
# Create .SRCINFO
makepkg --printsrcinfo > .SRCINFO
echo "AUR package files created (manual upload required)"
create-deb-rpm:
name: Create DEB and RPM packages
runs-on: ubuntu-latest
needs: []
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Download Linux binary
run: |
wget https://github.com/${{ github.repository }}/releases/download/${{ github.ref_name }}/rskiller-linux-x64.tar.gz
tar -xzf rskiller-linux-x64.tar.gz
- name: Create DEB package
run: |
mkdir -p deb-pkg/{DEBIAN,usr/bin,usr/share/doc/rskiller,usr/share/man/man1}
# Copy binary
cp rskiller deb-pkg/usr/bin/
chmod +x deb-pkg/usr/bin/rskiller
# Create control file
cat > deb-pkg/DEBIAN/control << EOF
Package: rskiller
Version: ${GITHUB_REF#refs/tags/v}
Section: utils
Priority: optional
Architecture: amd64
Maintainer: NakaSato <nakasato@example.com>
Description: Find and clean Rust project build artifacts and caches
rskiller is a command-line tool for finding and cleaning Rust project
build artifacts, target directories, and other cache files to free up
disk space. It features parallel processing, interactive mode, and
comprehensive configuration options.
Homepage: https://github.com/NakaSato/rskiller
EOF
# Copy documentation
cp README.md deb-pkg/usr/share/doc/rskiller/
# Build package
dpkg-deb --build deb-pkg
mv deb-pkg.deb rskiller_${GITHUB_REF#refs/tags/v}_amd64.deb
- name: Create RPM package
run: |
# Install rpm build tools
sudo apt-get update
sudo apt-get install -y rpm
# Create RPM spec
mkdir -p rpmbuild/{BUILD,BUILDROOT,RPMS,SOURCES,SPECS,SRPMS}
cat > rpmbuild/SPECS/rskiller.spec << EOF
Name: rskiller
Version: ${GITHUB_REF#refs/tags/v}
Release: 1%{?dist}
Summary: Find and clean Rust project build artifacts and caches
License: MIT
URL: https://github.com/NakaSato/rskiller
Source0: rskiller
BuildArch: x86_64
%description
rskiller is a command-line tool for finding and cleaning Rust project
build artifacts, target directories, and other cache files to free up
disk space.
%install
mkdir -p %{buildroot}%{_bindir}
cp %{SOURCE0} %{buildroot}%{_bindir}/rskiller
chmod +x %{buildroot}%{_bindir}/rskiller
%files
%{_bindir}/rskiller
%changelog
* $(date +'%a %b %d %Y') NakaSato <nakasato@example.com> - ${GITHUB_REF#refs/tags/v}-1
- Updated to version ${GITHUB_REF#refs/tags/v}
EOF
# Copy source
cp rskiller rpmbuild/SOURCES/
# Build RPM
rpmbuild --define "_topdir $(pwd)/rpmbuild" -bb rpmbuild/SPECS/rskiller.spec
# Copy result
cp rpmbuild/RPMS/x86_64/rskiller-*.rpm ./
- name: Upload packages to release
uses: softprops/action-gh-release@v1
with:
files: |
*.deb
*.rpm
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}