Skip to content

Daily rebuild of ClamAV docker image with latest definitions #1480

Daily rebuild of ClamAV docker image with latest definitions

Daily rebuild of ClamAV docker image with latest definitions #1480

Workflow file for this run

name: Daily rebuild of ClamAV docker image with latest definitions
on:
schedule:
- cron: "0 0 * * *"
jobs:
daily_rebuild:
runs-on: ubuntu-latest
steps:
- name: Update latest version definition
env:
GITHUB_TOKEN: ${{ secrets.CITIZENSADVICE_CLAMAV_GITHUB_TOKEN }}
run: |
# Update latest version definition script
cd $GITHUB_WORKSPACE
git init
git pull https://x-access-token:${GITHUB_TOKEN}@github.com/citizensadvice/clamav-docker.git
git checkout master
git remote add origin https://x-access-token:${GITHUB_TOKEN}@github.com/citizensadvice/clamav-docker.git
# ClamAV publishes version numbers through DNS
# We publish that version number to the repository
# This is also used in the suggested local mirror update scripts
# https://www.clamav.net/documents/private-local-mirrors
regex="current\.cvd\.clamav\.net.+text.*=.*\"(.*)\""
if [[ $(nslookup -type=TXT current.cvd.clamav.net) =~ $regex ]]
then
current_version=${BASH_REMATCH[1]}
echo "$current_version" > ./current.cvd.clamav.net.txt
echo "Updating to cvd $current_version"
# Configure git to push using the citizensadvice-clamav user
git config --global user.email "[email protected]"
git config --global user.name "Citizens Advice GitHub Action"
git checkout master
# Push the change
git add ./current.cvd.clamav.net.txt
git commit -a -m "Version update to $current_version"
git push --set-upstream origin master
else
echo "Couldn't fetch clamav signature versions."
exit 1
fi