From 6d973c06ca30b6fedcf679b1ee7585805d363ae9 Mon Sep 17 00:00:00 2001
From: Frank Sauerburger <frank@sauerburger.com>
Date: Sun, 15 Sep 2024 14:24:12 +0200
Subject: [PATCH] Add deployment

---
 .gitlab-ci.yml | 37 +++++++++++++++++++++++++++++++++++++
 Cargo.toml     |  2 +-
 LICENSE        | 22 ++++++++++++++++++++++
 pyproject.toml |  3 +++
 4 files changed, 63 insertions(+), 1 deletion(-)
 create mode 100644 .gitlab-ci.yml
 create mode 100644 LICENSE

diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
new file mode 100644
index 0000000..871b5ea
--- /dev/null
+++ b/.gitlab-ci.yml
@@ -0,0 +1,37 @@
+
+stages:
+  - deploy:staging
+  - deploy:production
+
+.deploy:
+  image:
+    name: ghcr.io/pyo3/maturin:v1.7.1
+    entrypoint: ["/usr/bin/bash"]
+  script:
+    - sed -i "s/##VERSION##/$CI_COMMIT_TAG/g" Cargo.toml
+    - sed -i "s/##VERSION##/$CI_COMMIT_TAG/g" pyproject.toml
+    - maturin publish --repository-url $MATURIN_REPOSITORY_URL --token $MATURIN_PYPI_TOKEN
+  rules:
+  - if: $CI_COMMIT_TAG
+  artifacts:
+    expire_in: 1 week
+    paths:
+      - target/*
+
+
+deploy:staging:
+    extends: .deploy
+    stage: deploy:staging
+    environment:
+      name: staging
+    variables:
+        MATURIN_REPOSITORY_URL: https://test.pypi.org/legacy/
+
+deploy:production:
+    extends: .deploy
+    stage: deploy:production
+    when: manual
+    environment:
+      name: production
+    variables:
+      MATURIN_REPOSITORY_URL: https://pypi.org/legacy/
diff --git a/Cargo.toml b/Cargo.toml
index 3fb77c4..b002291 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -1,6 +1,6 @@
 [package]
 name = "polars-loess"
-version = "0.1.0"
+version = "##VERSION##
 edition = "2021"
 
 [lib]
diff --git a/LICENSE b/LICENSE
new file mode 100644
index 0000000..2b08eb1
--- /dev/null
+++ b/LICENSE
@@ -0,0 +1,22 @@
+MIT License
+
+Copyright (c) 2024 João Paulo Figueira (LOESS algorithm)
+Copyright (c) 2024 Frank Sauerburger (Adaption for Polars)
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all
+copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+SOFTWARE.
diff --git a/pyproject.toml b/pyproject.toml
index 7a5511f..2a90baa 100644
--- a/pyproject.toml
+++ b/pyproject.toml
@@ -1,6 +1,9 @@
 [build-system]
 requires = ["maturin>=1.0,<2.0", "polars>=0.20.6"]
 build-backend = "maturin"
+readme = "README.md"
+license = "MIT"
+version = "##VERSION##"
 
 [project]
 name = "polars-loess"
-- 
GitLab