Skip to content

Update Repository

Update Repository #1

Workflow file for this run

name: Update Repository
on:
schedule:
- cron: '0 17 * * *'
workflow_dispatch:
jobs:
update:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
ref: source
- name: Import GPG key
id: import_gpg
uses: crazy-max/ghaction-import-gpg@v6
with:
gpg_private_key: ${{ secrets.GPG_PRIVATE_KEY }}
passphrase: ${{ secrets.PASSPHRASE }}
- name: Prepare scripts
run: |
sudo apt-get update
sudo apt-get install -y reprepro gnupg-agent
mkdir -p dist debian/dists debian/pool ~/.gnupg
echo > ~/.gnupg/gpg-agent.conf <<EOF
max-cache-ttl 60480000
default-cache-ttl 60480000
allow-preset-passphrase
EOF
gpg-connect-agent reloadagent /bye
- name: Check gh-cli packages
run: |
version=$(curl -s "https://api.github.com/repos/cli/cli/releases/latest" | jq -r ".tag_name")
if [ -z "$version" ] || [ "$version" == "null" ]; then
echo "Failed to get gh-cli version"
exit 1
fi
if cat debian/dists/trixie/main/binary-loong64/Packages | grep -A1 "^Package: gh$" | grep -q "${version/v/}"; then
gh release download ${version} -p '*loong64.deb' --dir dist --repo loong64/cli || exit 1
fi
- name: Check docker-ce packages
run: |
version=$(curl -s "https://api.github.com/repos/moby/moby/releases/latest" | jq -r ".tag_name")
if [ -z "$version" ] || [ "$version" == "null" ]; then
echo "Failed to get docker-ce version"
exit 1
fi
if cat debian/dists/trixie/main/binary-loong64/Packages | grep -A1 "^Package: docker-ce$" | grep -q "${version/v/}"; then
gh release download ${version} -p '*.deb' --dir dist --repo loong64/docker-ce-packaging || exit 1
fi
- name: Check containerd.io packages
run: |
version=v$(curl -sSL https://github.com/docker/containerd-packaging/raw/main/debian/changelog | head -n 1 | grep -oP '\(\K[^\)]+' | cut -d'-' -f1)
if [ -z "$version" ] || [ "$version" == "null" ]; then
echo "Failed to get containerd.io version"
exit 1
fi
if cat debian/dists/trixie/main/binary-loong64/Packages | grep -A1 "^Package: containerd.io$" | grep -q "${version/v/}"; then
gh release download ${version} -p '*.deb' --dir dist --repo loong64/containerd-packaging || exit 1
fi
- name: Update repository
run: |
KEYGRIP=$(gpg -K --with-keygrip | grep Keygrip | head -1 | awk '{print $3}')
/usr/lib/gnupg2/gpg-preset-passphrase --preset "$KEYGRIP" <<< "${{ secrets.PASSPHRASE }}"
reprepro -Vb debian includedeb trixie dist/*.deb
- name: Push changes
run: |
git config --global user.name "github-actions[bot]"
git config --global user.email "github-actions[bot]@users.noreply.github.com"
git branch -D master
git checkout -b master
git add .
git commit -m "Update repository"
git push origin master --force