@@ -42,6 +42,7 @@ Die Skripte koennen aus dem neuesten GitHub Release-Tag geladen werden (statt vo
4242
4343``` bash
4444LATEST_TAG=$( curl -fsSL https://api.github.com/repos/obcode/generate_startercode/releases/latest | python3 -c " import json,sys; print(json.load(sys.stdin)['tag_name'])" )
45+ export GENERATE_STARTERCODE_VERSION=" ${LATEST_TAG# v} "
4546
4647curl -fsSL " https://raw.githubusercontent.com/obcode/generate_startercode/${LATEST_TAG} /transform.py" -o /tmp/transform.py
4748curl -fsSL " https://raw.githubusercontent.com/obcode/generate_startercode/${LATEST_TAG} /sync_issue.py" -o /tmp/sync_issue.py
@@ -59,11 +60,12 @@ sync-issue:
5960 stage : sync
6061 image : ${CI_DEPENDENCY_PROXY_DIRECT_GROUP_IMAGE_PREFIX}/library/python:3.12-bookworm
6162 script :
63+ - set -eu
6264 - pip install "python-gitlab[graphql]" --quiet
63- - |
64- set -eu
65- LATEST_TAG=$(curl -fsSL https://api.github.com/repos/obcode/generate_startercode/releases/latest | python3 -c "import json,sys; print(json.load(sys.stdin)['tag_name'])")
66- curl -fsSL "https://raw.githubusercontent.com/obcode/generate_startercode/${LATEST_TAG}/sync_issue.py" -o /tmp/sync_issue.py
65+ - LATEST_TAG=$(curl -fsSL https://api.github.com/repos/obcode/generate_startercode/releases/latest | python3 -c "import json,sys; print(json.load(sys.stdin)['tag_name'])")
66+ - export GENERATE_STARTERCODE_VERSION="${LATEST_TAG#v}"
67+ - echo "[sync-issue] Using release ${LATEST_TAG}"
68+ - curl -fsSL "https://raw.githubusercontent.com/obcode/generate_startercode/${LATEST_TAG}/sync_issue.py" -o /tmp/sync_issue.py
6769 - python /tmp/sync_issue.py
6870 rules :
6971 - if : ' $CI_COMMIT_BRANCH == "main"'
@@ -77,22 +79,20 @@ publish-branches:
7779 stage : publish
7880 image : ${CI_DEPENDENCY_PROXY_DIRECT_GROUP_IMAGE_PREFIX}/library/python:3.12-bookworm
7981 before_script :
82+ - set -eu
8083 - pip install pyyaml --quiet
8184 - git config user.email "ci@gitlab"
8285 - git config user.name "CI"
8386 - git remote set-url origin "https://oauth2:${GITLAB_TOKEN}@${CI_SERVER_HOST}/${CI_PROJECT_PATH}.git"
8487 script :
85- - |
86- set -eu
87- echo "[publish-branches] Download transform.py from latest release"
88- LATEST_TAG=$(curl -fsSL https://api.github.com/repos/obcode/generate_startercode/releases/latest | python3 -c "import json,sys; print(json.load(sys.stdin)['tag_name'])")
89- curl -fsSL "https://raw.githubusercontent.com/obcode/generate_startercode/${LATEST_TAG}/transform.py" -o /tmp/transform.py
90-
91- echo "[publish-branches] Run target=solution"
92- python /tmp/transform.py --target solution --repo-root "$CI_PROJECT_DIR" --config .gitlab/ci/config.yml --no-skip-ci
93-
94- echo "[publish-branches] Run target=startercode"
95- python /tmp/transform.py --target startercode --repo-root "$CI_PROJECT_DIR" --config .gitlab/ci/config.yml --no-skip-ci
88+ - LATEST_TAG=$(curl -fsSL https://api.github.com/repos/obcode/generate_startercode/releases/latest | python3 -c "import json,sys; print(json.load(sys.stdin)['tag_name'])")
89+ - export GENERATE_STARTERCODE_VERSION="${LATEST_TAG#v}"
90+ - echo "[publish-branches] Download transform.py from release ${LATEST_TAG}"
91+ - curl -fsSL "https://raw.githubusercontent.com/obcode/generate_startercode/${LATEST_TAG}/transform.py" -o /tmp/transform.py
92+ - echo "[publish-branches] Run target=solution"
93+ - python /tmp/transform.py --target solution --repo-root "$CI_PROJECT_DIR" --config .gitlab/ci/config.yml --no-skip-ci
94+ - echo "[publish-branches] Run target=startercode"
95+ - python /tmp/transform.py --target startercode --repo-root "$CI_PROJECT_DIR" --config .gitlab/ci/config.yml --no-skip-ci
9696 rules :
9797 - if : ' $CI_COMMIT_BRANCH == "main"'
9898 changes :
@@ -104,7 +104,7 @@ publish-branches:
104104 - .gitlab-ci.yml
105105` ` `
106106
107- Hinweis: Dafuer muss mindestens ein GitHub Release vorhanden sein. Falls noch kein Release existiert, initial einmalig gegen einen festen Tag laden (zum Beispiel v0.1 .0) oder kurzzeitig gegen main.
107+ Hinweis: Dafuer muss mindestens ein GitHub Release vorhanden sein. Die zusaetzliche Umgebungsvariable GENERATE_STARTERCODE_VERSION sorgt dafuer, dass das heruntergeladene Einzel-Skript auch ohne lokales pyproject die richtige Release-Version anzeigt. Falls noch kein Release existiert, initial einmalig gegen einen festen Tag laden (zum Beispiel v1.0 .0) oder kurzzeitig gegen main.
108108
109109## GitHub Actions
110110
0 commit comments