diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml new file mode 100644 index 0000000..172757e --- /dev/null +++ b/.gitlab-ci.yml @@ -0,0 +1,58 @@ +default: + image: debian:11 + +stages: + - build + - publish + - release + +build: + stage: build + image: golang:1.21-alpine + before_script: + - apk update && apk add --no-cache make git + script: + - make build_password + artifacts: + paths: + - ./bin/* + +publish_main: + stage: publish + image: golang:1.21-alpine + variables: + VER: latest + before_script: + - apk update && apk add --no-cache make git curl + script: + - make publish_password + needs: + - build + only: + - main + +release_tag: + stage: publish + image: golang:1.21-alpine + variables: + VER: ${CI_COMMIT_TAG} + before_script: + - apk update && apk add --no-cache make git curl + script: + - make publish_password + needs: + - build + only: + - tags + +release_job: + stage: release + image: registry.gitlab.com/gitlab-org/release-cli:latest + rules: + - if: $CI_COMMIT_TAG + before_script: + - apk update && apk add --no-cache bash curl + script: + - bash ./scripts/gitlab_release.sh -r ./docs/release/$CI_COMMIT_TAG* -a ./bin/ + needs: + - build \ No newline at end of file diff --git a/README.md b/README.md index 6a22633..5699b12 100644 --- a/README.md +++ b/README.md @@ -4,11 +4,11 @@ Some tools use and dev for h6n, many are in shell/bash could be use in other pro ## Version -v1.4.0: Gabriel +v1.2.0: Valentin ## release script -To use the release script it's simple `curl https://git.g3e.fr/H6N/tools/raw/branch/main/scripts/release.sh | bash -s - [param list]` +To use the release script it's simple `curl https://gitlab.g3e.fr/h6n/tools/-/raw/main/scripts/release.sh | bash -s - [param list]` In dev mode you can do `cat ./scripts/release.sh | bash -s - [param list]` diff --git a/docs/release.md b/docs/release.md index f07ef97..54fc7b3 100644 --- a/docs/release.md +++ b/docs/release.md @@ -4,17 +4,6 @@ The naming policy is based on first names for this project. -# Release procedure - -``` -bash ./scripts/release.sh -t [VERSION] -n [RELEASE_NAME] -c -edit specifique files: -- ./release/next_release.md -bash ./scripts/release.sh -``` - ## Release list -- [v1.4.0 Gabriel](./docs/release/v1.4.0_gabriel.md) -- [v1.3.0 Xavier](./release/v1.3.0_xavier.md) -- [v1.2.0 Valentin](./release/v1.2.0_valentin.md) + - [v1.0.0 Damian](./release/v1.0.0_damian.md) diff --git a/docs/release/v1.3.0_xavier.md b/docs/release/v1.3.0_xavier.md deleted file mode 100644 index 28c8837..0000000 --- a/docs/release/v1.3.0_xavier.md +++ /dev/null @@ -1,8 +0,0 @@ -# Xavier v1.3.0 - -## Release feature - -- update readme -- update script -- add ci for forgejo -- clean old ci \ No newline at end of file diff --git a/docs/release/v1.4.0_gabriel.md b/docs/release/v1.4.0_gabriel.md deleted file mode 100644 index 5f9b7e9..0000000 --- a/docs/release/v1.4.0_gabriel.md +++ /dev/null @@ -1,6 +0,0 @@ -# Gabriel v1.4.0 - -## Release feature - -- [PR](https://git.g3e.fr/H6N/tools/pulls/11) edit doc release.md file -- [PR](https://git.g3e.fr/H6N/tools/pulls/11) add procedure upgrade diff --git a/scripts/gitlab_release.sh b/scripts/gitlab_release.sh index 2d8d01c..6a85d01 100644 --- a/scripts/gitlab_release.sh +++ b/scripts/gitlab_release.sh @@ -17,7 +17,7 @@ exec_with_dry_run () { main () { - [[ -f ./libs/shflags ]] && . ./libs/shflags || eval "$(curl --silent https://git.g3e.fr/H6N/tools/raw/branch/main/libs/shflags)" + [[ -f ./libs/shflags ]] && . ./libs/shflags || eval "$(curl --silent https://gitlab.g3e.fr/h6n/tools/-/raw/main/libs/shflags)" [[ -f ./.config/gitlab_release ]] && . ./.config/gitlab_release DEFINE_string 'artifact_path' '' 'Path of artifact list' 'a' diff --git a/scripts/release.sh b/scripts/release.sh index cb5e6ce..e62231c 100755 --- a/scripts/release.sh +++ b/scripts/release.sh @@ -34,7 +34,7 @@ edit_file () { } main () { - [[ -f ./libs/shflags ]] && . ./libs/shflags || eval "$(curl --silent https://git.g3e.fr/H6N/tools/raw/branch/main/libs/shflags)" + [[ -f ./libs/shflags ]] && . ./libs/shflags || eval "$(curl --silent https://gitlab.g3e.fr/h6n/tools/-/raw/main/libs/shflags)" @@ -43,7 +43,6 @@ main () { DEFINE_boolean 'create_branch' false 'Creation de la branch' 'c' DEFINE_boolean 'dryrun' false 'Enable dry-run mode' 'd' DEFINE_string 'release_path' './docs/release' 'Release path' 'p' - DEFINE_string 'doc_path' './docs/release.md' 'Documentation path' 'u' DEFINE_string 'regex_version' 'v[0-9]*.[0-9]*.[0-9]*' 'Version Regex' 'r' FLAGS "$@" || exit $? @@ -72,8 +71,6 @@ main () { echo "Release ${NAME} - ${VERSION}" echo "Edit README file" edit_file "${FLAGS_dryrun}" "sed ${SED_PARAM} 's/^${FLAGS_regex_version}: [A-Z|a-z| ]*$/${VERSION}: ${NAME}/' ./README.md" "./README.md" || return 1 - edit_file "${FLAGS_dryrun}" "sed ${SED_PARAM} '/^## Release list$/a\\ -- [${VERSION} ${NAME}](${FLAGS_release_path}/${VERSION}_${LOWER_NAME}.md)' ${FLAGS_doc_path}" "${FLAGS_doc_path}" || return 1 edit_file "${FLAGS_dryrun}" "mv '${FLAGS_release_path}/next_release.md' '${FLAGS_release_path}/${VERSION}_${LOWER_NAME}.md'" "${FLAGS_release_path}/${VERSION}_${LOWER_NAME}.md" || return 1 exec_with_dry_run "${FLAGS_dryrun}" "git commit -s -S -m 'release-${VERSION}'" || return 1 exec_with_dry_run "${FLAGS_dryrun}" "git tag '${VERSION}' -s -m 'Release ${VERSION} ${NAME}'" || return 1