diff --git a/.github/build.yml.template b/.github/build.yml.template new file mode 100644 index 0000000..61ef138 --- /dev/null +++ b/.github/build.yml.template @@ -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 diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index c307572..41f9bc6 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -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 }} \ diff --git a/images/README.md b/images/README.md index 66ad78b..08c10ed 100644 --- a/images/README.md +++ b/images/README.md @@ -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. diff --git a/update.sh b/update.sh index 38df26f..4ddffe5 100755 --- a/update.sh +++ b/update.sh @@ -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