Update update.sh to regenerate .github/workflows/build.yml automagically

This commit is contained in:
Aloïs Micard
2025-04-09 11:38:39 +02:00
parent c1fe0435e3
commit bbea47b769
4 changed files with 60 additions and 3 deletions

48
.github/build.yml.template vendored Normal file
View File

@@ -0,0 +1,48 @@
# This file is generated automatically when running './update.sh'
# Please do not edit it directly!
# Instead perform any modifications in .github/build.yml.template
name: build
on:
# can run job manually
workflow_dispatch:
# Run once a week
schedule:
- cron: '0 0 * * 6'
jobs:
build-docker-images:
strategy:
matrix:
dolibarr_version: [ %DOLIBARR_VERSIONS% ]
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v3
- uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKER_HUB_USERNAME }}
password: ${{ secrets.DOCKER_HUB_PASSWORD }}
- uses: docker/setup-qemu-action@v3
- uses: docker/setup-buildx-action@v3
- env:
DOCKER_BUILD: 1
DOCKER_PUSH: 1
run: |
./update.sh ${{ matrix.dolibarr_version }}
update-readme:
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v3
- run: |
echo secrets.DOCKER_HUB_USERNAME=${{ secrets.DOCKER_HUB_USERNAME }}
docker run --rm -t \
-v $(pwd):/src \
-e DOCKER_USER=${{ secrets.DOCKER_HUB_USERNAME }} \
-e DOCKER_PASS=${{ secrets.DOCKER_HUB_PASSWORD }} \
-e PUSHRM_PROVIDER=dockerhub \
-e PUSHRM_FILE=/src/README.md \
-e PUSHRM_SHORT='Docker image for Dolibarr ERP CRM Open source web suite.' \
-e PUSHRM_TARGET=docker.io/dolibarr/dolibarr \
-e PUSHRM_DEBUG=1 \
chko/docker-pushrm:1

View File

@@ -1,3 +1,7 @@
# This file is generated automatically when running './update.sh'
# Please do not edit it directly!
# Instead perform any modifications in .github/build.yml.template
name: build
on:
# can run job manually
@@ -31,7 +35,7 @@ jobs:
steps:
- uses: actions/checkout@v3
- run: |
echo secrets.DOCKER_HUB_USERNAME=${{ secrets.DOCKER_HUB_USERNAME }}
echo secrets.DOCKER_HUB_USERNAME=${{ secrets.DOCKER_HUB_USERNAME }}
docker run --rm -t \
-v $(pwd):/src \
-e DOCKER_USER=${{ secrets.DOCKER_HUB_USERNAME }} \

View File

@@ -1 +1 @@
All files in this directory and subdirectories are generated with the script update.sh using
All files in this directory and subdirectories are generated with the script update.sh.

View File

@@ -21,7 +21,12 @@ source "${BASE_DIR}/versions.sh"
tags=""
# First, clean the directory /images
# Generate an up-to-date copy of .github/workflows/build.yml using the Dolibarr versions as defined in versions.sh
FORMATTED_DOLIBARR_VERSIONS=$(IFS=","; echo "${DOLIBARR_VERSIONS[*]}")
sed 's/%DOLIBARR_VERSIONS%/'"$FORMATTED_DOLIBARR_VERSIONS"'/g' "${BASE_DIR}/.github/build.yml.template" | sed 's/,/, /g' > "${BASE_DIR}/.github/workflows/build.yml"
exit 0
# Clean the directory /images
if [ -f "${BASE_DIR}/images/README.md" ]; then
cp -f "${BASE_DIR}/images/README.md" "/tmp/tmp-README.md"
fi