Skip to content

Commit

Permalink
Merge branch 'hotfix-pablo' into prod-0
Browse files Browse the repository at this point in the history
  • Loading branch information
petrzpav committed May 10, 2023
2 parents aabbf68 + 7ba2ce1 commit c1d3f7f
Show file tree
Hide file tree
Showing 4 changed files with 38 additions and 8 deletions.
12 changes: 12 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,17 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](http://keepachangelog.com/)
and this project adheres to [Semantic Versioning](http://semver.org/).

## [0.5.1] - 2023-05-10

### Fixed

- Switching academy version in gitlab-ci include causes ci error.
- Distribute not working due to invalid variable.

### Added

- Add --force-merge param to distribute.

## [0.5.0] - 2023-05-02

_Stable release based on [0.5.0-rc.1]._
Expand Down Expand Up @@ -32,6 +43,7 @@ _Stable release based on [0.5.0-rc.1]._
- Set name of distributed project as `original_project_name user_name`


[0.5.1]: https://https://github.com/internetguru/academy/compare/v0.5.0...v0.5.1
[0.5.0]: https://https://github.com/internetguru/academy/compare/v0.4.0...v0.5.0
[0.5.0-rc.1]: https://github.com/internetguru/academy/releases/tag/v0.4.0
[0.4.0]: https://github.com/internetguru/academy/compare/v0.3.0...v0.4.0
Expand Down
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
0.5.0
0.5.1
21 changes: 16 additions & 5 deletions distribute
Original file line number Diff line number Diff line change
Expand Up @@ -92,9 +92,15 @@ update_user_repo() {
git_add_all "${user_cache_folder}"
git_commit "${user_cache_folder}" '-m "Update assignment"'
git_push "${user_cache_folder}" '--all'
declare project_id
request_exists \
|| create_request
if [[ $FORCE_MERGE == 1 ]]; then
git_checkout "${user_cache_folder}" "${user_default_branch}"
git_merge "${user_cache_folder}" '--no-ff' "${SOURCE_BRANCH}"
git_push "${user_cache_folder}" origin "${user_default_branch}"
git_checkout "${user_cache_folder}" "${SOURCE_BRANCH}"
else
request_exists \
|| create_request
fi
copy_issues
set_public_pages "${project_id}" >/dev/null
}
Expand Down Expand Up @@ -294,11 +300,12 @@ declare -i ISSUES_COUNT=0
declare -i issues_count_src="${ISSUES_COUNT}"
# shellcheck disable=SC2034
declare ACADEMY_GITLAB_ACCESS_TOKEN
declare FORCE_MERGE=0

# get options
declare OPT
OPT="$(getopt --name "${0}" --options 'a:d:hi:lno:p:s:r:' \
--longoptions 'assign:,help,process-issues:,update-links,default-branch-namespace:,dry-run,output-dir:,prefix:,member-role:,namespace:' \
OPT="$(getopt --name "${0}" --options 'a:d:hi:lno:p:s:r:m' \
--longoptions 'assign:,help,process-issues:,update-links,default-branch-namespace:,dry-run,output-dir:,prefix:,member-role:,namespace:,force-merge' \
-- "$@")" \
&& eval set -- "${OPT}" \
|| exit 1
Expand Down Expand Up @@ -332,6 +339,10 @@ while (( $# > 0 )); do
|| exception 'Readme file not found in WORKING_DIR'
shift
;;
-m|--force-merge)
FORCE_MERGE=1
shift
;;
-n|--dry-run)
DRY_RUN='true'
shift
Expand Down
11 changes: 9 additions & 2 deletions gitlab-stages.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ variables:
ACADEMY_DOCKER_IMAGE: ${ACADEMY_DEFAULT_DOCKER_IMAGE}
ACADEMY_CACHE: "../.academy-cache"
ACADEMY_EDITABLE: "*.*"
ACADEMY_FORCE_MERGE: ""

cache:
- key: academy-cache
Expand Down Expand Up @@ -47,7 +48,9 @@ cache:
fi
if [[ -d "${ACADEMY_DIR}/.git" ]]; then
git -C "${ACADEMY_DIR}" reset --hard
git -C "${ACADEMY_DIR}" pull origin ${revision}
git -C "${ACADEMY_DIR}" config --replace-all remote.origin.fetch "+refs/heads/*:refs/remotes/origin/*"
git -C "${ACADEMY_DIR}" fetch origin ${revision}
git -C "${ACADEMY_DIR}" checkout origin/${revision}
else
git clone --single-branch --branch ${revision} https://github.com/InternetGuru/academy ${ACADEMY_DIR}
fi
Expand Down Expand Up @@ -180,7 +183,11 @@ distribute:
# TODO remove other existing repositories
else
users="$(get_users)"
${ACADEMY} distribute --update-links --namespace "${user_namespace}" \
declare merge=''
if [[ -n "${ACADEMY_FORCE_MERGE}" ]]; then
merge='--force-merge'
fi
${ACADEMY} distribute ${merge} --update-links --namespace "${user_namespace}" \
--process-issues "${ACADEMY_ISSUES:-${CI_COMMIT_REF_NAME}}" \
<<< "${users}"
fi
Expand Down

0 comments on commit c1d3f7f

Please sign in to comment.