diff --git a/.github/workflows/convert.yml b/.github/workflows/convert.yml index 0eea13f2215a63255874cee19a6513caef7b2f17..431ed01861ca173afbf785f8852080b7648fe717 100644 --- a/.github/workflows/convert.yml +++ b/.github/workflows/convert.yml @@ -1,9 +1,6 @@ name: Convert data to .mat file(s) on: - push: - branches: - - "main" schedule: - cron: "0 1 * * *" diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml new file mode 100644 index 0000000000000000000000000000000000000000..0e195e2242a4598e3137db957eaad7a40fd7a45c --- /dev/null +++ b/.gitlab-ci.yml @@ -0,0 +1,40 @@ + +stages: + - convert + - upload + - release + +variables: + PACKAGE_REGISTRY_URL: "${CI_API_V4_URL}/projects/${CI_PROJECT_ID}/packages/generic/my_package/latest/data.zip" + +convert: + stage: convert + image: "python:3.10" + before_script: + - apk add --update zip + script: + - python3 -m pip install --upgrade pip + - python3 -m pip install numpy scipy + - python3 convert.py + - cd out && zip ../data.zip ./* && cd - + artifacts: + paths: + - data.zip + - CHANGELOG.md + +upload: + stage: upload + image: curlimages/curl:latest + script: + - echo "Compiling the code..." + - echo "Compile complete." + script: + - 'curl --header "JOB-TOKEN: ${CI_JOB_TOKEN}" --upload-file data.zip "${PACKAGE_REGISTRY_URL}"' + +release: + stage: release + image: registry.gitlab.com/gitlab-org/release-cli:latest + script: + - | + release-cli create --name "Data" --tag-name "latest" --description "CHANGELOG.md" \ + --assets-link "{\"name\":\"${data.zip}\",\"url\":\"${PACKAGE_REGISTRY_URL}\"}" \ \ No newline at end of file diff --git a/convert.py b/convert.py index f0b0cd5b9be2803d88e13a294f1bd59adab082e9..e5f0cbf063719b4682a5f3fe14ca1196af014ec6 100644 --- a/convert.py +++ b/convert.py @@ -49,4 +49,4 @@ for week_start, arr in data.items(): # Update CHANGELOG.md with open(str(Path.joinpath(Path(__file__).parent, "CHANGELOG.md")), "w+") as f: - f.write("# Messdaten vom Silo von den Wochen:\n" + "\n".join(["- " + key for key in data.keys()])) + f.write("## Messdaten vom Silo von den Wochen:\n" + "\n".join(["- " + key for key in data.keys()]))