Update .forgejo/workflows/package-check.yml

This commit is contained in:
melody 2025-07-14 05:16:55 +02:00
commit 34095b6007

View file

@ -1,8 +1,9 @@
name: Build monero node
name: Auto Build Monero Node Docker Container
on:
workflow_dispatch:
- cron: '12 */3 * * *'
jobs:
build:
@ -20,10 +21,36 @@ jobs:
- name: Install dependencies
shell: sh
run: |
apk add --no-cache git bash
git clone https://github.com/monero-project/monero
apk add --no-cache git bash jq nodejs npm
- uses: actions/checkout@v3
- name: Get latest package version
id: check
run: |
newest_version=$(curl https://api.github.com/repos/monero-project/monero/releases/latest | jq -r .tag_name)
echo "NEWEST_VERSION=$newest_version" >> $GITHUB_ENV
- name: Determine if update is needed
run: |
last_version_file=".last_version"
last_rebuild_file=".last_rebuild"
last_version=$(cat $last_version_file 2>/dev/null || echo "none")
last_rebuild=$(cat $last_rebuild_file 2>/dev/null || echo 0)
current_day=$(( $(date +%s) / 86400 ))
update="false"
if [ "$last_version" != "$NEWEST_VERSION" ] || [ $((current_day - last_rebuild)) -gt 14 ]; then
update="true"
fi
echo "UPDATE=$update" >> $GITHUB_ENV
- name: Start Docker daemon
if: env.UPDATE == 'true'
run: |
dockerd-entrypoint.sh &
for i in {1..10}; do
@ -34,9 +61,24 @@ jobs:
docker info || { echo "Docker daemon failed to start."; exit 1; }
- name: Build and push Docker image
if: env.UPDATE == 'true'
run: |
cd monero
git clone https://github.com/monero-project/monero ../monero
cd ../monero
git fetch --all --tags
git checkout tags/$NEWEST_VERSION
docker build --build-arg NPROC=1 -t $DOCKER_REGISTRY/$REGISTRY_USER/docker-$PACKAGE:latest .
echo "${{ secrets.DOCKER_PASSWORD }}" | docker login $DOCKER_REGISTRY -u "${{ secrets.DOCKER_USERNAME }}" --password-stdin
docker push $DOCKER_REGISTRY/$REGISTRY_USER/docker-$PACKAGE:latest
cd
echo "$NEWEST_VERSION" > .last_version
echo $(( $(date +%s) / 86400 )) > .last_rebuild
- name: Commit updated metadata
if: env.UPDATE == 'true'
run: |
git config user.name "$COMMIT_AUTHOR_NAME"
git config user.email "$COMMIT_AUTHOR_EMAIL"
git add .last_version .last_rebuild
git commit -m "$COMMIT_MESSAGE"
git push