From 8536c97f73ac010ac5673eb88614f8ceb4f710d5 Mon Sep 17 00:00:00 2001 From: vista Date: Mon, 26 Aug 2024 13:42:58 +0200 Subject: [PATCH 1/2] fix script to set tags Co-authored-by: Ruben Momoa Reviewed-on: https://git.narvas.tech/vista/simple-laravel/pulls/13 --- .woodpecker/build_dev.yml | 10 +++++++++- gen-version-list.sh => gen-tag-list.sh | 15 ++++++--------- 2 files changed, 15 insertions(+), 10 deletions(-) rename gen-version-list.sh => gen-tag-list.sh (67%) diff --git a/.woodpecker/build_dev.yml b/.woodpecker/build_dev.yml index 794e833..3cb0c57 100644 --- a/.woodpecker/build_dev.yml +++ b/.woodpecker/build_dev.yml @@ -6,10 +6,18 @@ when: branch: exclude: [ main, master ] path: - include: [ '.woodpecker/build_dev.yml', 'build/*', 'Dockerfile' ] + include: [ '.woodpecker/build_dev.yml', 'build/*', 'Dockerfile', 'gen-tag-list.sh' ] event: [ push, manual ] steps: + + gen_tags: + image: docker + commands: + - pwd + - ./gen-version-list.sh "v2.0.4" php-${PHP_VERSION} + - cat tags.txt + dev_alpine_build_and_publish: image: woodpeckerci/plugin-docker-buildx settings: diff --git a/gen-version-list.sh b/gen-tag-list.sh similarity index 67% rename from gen-version-list.sh rename to gen-tag-list.sh index 67612b3..2870132 100755 --- a/gen-version-list.sh +++ b/gen-tag-list.sh @@ -1,4 +1,4 @@ -#!/usr/bin/env bash +#!/usr/bin/env ash # this script generates a tags_file for Buildx (https://woodpecker-ci.org/plugins/Docker%20Buildx) @@ -21,13 +21,10 @@ if [[ "${version:0:1}" == "V" || "${version:0:1}" == "v" ]]; then fi # Split the version into an array using the "." as a delimiter -IFS='.' read -ra version_array <<< "$version" +# this sets $1 $2 and $3 +IFS='.' set -- "$version" echo "latest$suffix" > tags.txt - -# Iterate through the array and print each element followed by a new line -build_string="" -for i in "${version_array[@]}"; do - build_string="$build_string.$i" - echo "${build_string#?}$suffix" >> tags.txt -done \ No newline at end of file +echo "$1$suffix" >> tags.txt +echo "$1.$2$suffix" >> tags.txt +echo "$1.$2.$3$suffix" >> tags.txt \ No newline at end of file From 5bd57bae0abaf72d52d805d5298958c0a3de281f Mon Sep 17 00:00:00 2001 From: vista Date: Mon, 26 Aug 2024 14:57:46 +0200 Subject: [PATCH 2/2] fix cron tags (#21) Co-authored-by: Ruben Momoa Reviewed-on: https://git.narvas.tech/vista/simple-laravel/pulls/21 --- .woodpecker/build_release.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.woodpecker/build_release.yml b/.woodpecker/build_release.yml index 0333adb..4abc263 100644 --- a/.woodpecker/build_release.yml +++ b/.woodpecker/build_release.yml @@ -31,7 +31,7 @@ steps: gen_tags: image: docker commands: - - ./gen-tag-list.sh ${CI_COMMIT_TAG} php-${PHP_VERSION} + - ./gen-tag-list.sh $(git describe --tags HEAD --abbrev=0) php-${PHP_VERSION} - cat tags.txt release_alpine_build_and_publish: