Repository: aidotse/PASEOS (language: python)

Issue:
Create Release Process / Infrastructure
# Feature
## Desired Behavior / Functionality
To continuously release versions we need some infrastructure.

## What Needs to Be Done
- [ ] Release ticket to have a streamlined process
- [ ] Set up pypi and testpypi accounts
- [ ] Add actions for releasing to testpypi and pypi for convenience

## How Can It Be Tested
Will test in action on v0.1.0


Discussion / hints:

Fix patch:
diff --git a/.github/ISSUE_TEMPLATE/release.md b/.github/ISSUE_TEMPLATE/release.md
new file mode 100644
index 00000000..1e176ec4
--- /dev/null
+++ b/.github/ISSUE_TEMPLATE/release.md
@@ -0,0 +1,32 @@
+---
+name: New Release
+about: Creating a new release version for PASEOS. Only for Maintainers.
+title: "Release "
+labels: "release"
+assignees: "gomezzz"
+---
+
+# Feature
+
+## Changelog
+
+_to be written during release process_
+
+## What Needs to Be Done (chronologically)
+
+- [ ] Create PR to merge from current main into release branch
+- [ ] Write Changelog in PR and request review
+- [ ] Review the PR (if OK - merge, but DO NOT delete the branch)
+- [ ] Minimize packages in requirements.txt and conda-forge submission. Update packages in setup.py
+- [ ] Check unit tests -> Check all tests pass and there are tests for all important features
+- [ ] Check documentation -> Check presence of documentation for all features by locally building the docs on the release
+- [ ] Change version number in setup.py and docs (under conf.py)
+- [ ] Trigger the Upload Python Package to testpypi GitHub Action (https://github.com/aidotse/paseos/actions/workflows/deploy_to_test_pypi.yml) on the release branch (need to be logged in)
+- [ ] Test the build on testpypi (with `pip install --index-url https://test.pypi.org/simple/ --extra-index-url https://pypi.org/simple paseos`)
+- [ ] Finalize release on the release branch
+- [ ] Create PR: release → main
+- [ ] PR Reviews
+- [ ] Merge release back into main
+- [ ] Create Release on GitHub from the last commit (the one reviewed in the PR)
+- [ ] Upload to PyPI
+- [ ] Update on conda following https://conda-forge.org/docs/maintainer/updating_pkgs.html
\ No newline at end of file
diff --git a/.github/workflows/deploy_to_pypi.yml b/.github/workflows/deploy_to_pypi.yml
new file mode 100644
index 00000000..33d1ae5c
--- /dev/null
+++ b/.github/workflows/deploy_to_pypi.yml
@@ -0,0 +1,28 @@
+# This workflows will upload a Python Package using Twine when a release is created
+# For more information see: https://help.github.com/en/actions/language-and-framework-guides/using-python-with-github-actions#publishing-to-package-registries
+
+name: Upload Python Package to pypi
+
+on: workflow_dispatch
+
+jobs:
+  deploy:
+    runs-on: ubuntu-latest
+
+    steps:
+      - uses: actions/checkout@v2
+      - name: Set up Python
+        uses: actions/setup-python@v2
+        with:
+          python-version: "3.9"
+      - name: Install dependencies
+        run: |
+          pip install setuptools wheel twine
+          if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
+      - name: Build and publish
+        env:
+          TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }}
+          TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }}
+        run: |
+          python setup.py sdist bdist_wheel
+          twine upload dist/*


Test patch:
diff --git a/.github/workflows/deploy_to_test_pypi.yml b/.github/workflows/deploy_to_test_pypi.yml
new file mode 100644
index 00000000..dfaaece8
--- /dev/null
+++ b/.github/workflows/deploy_to_test_pypi.yml
@@ -0,0 +1,28 @@
+# This workflows will upload a Python Package using Twine when a release is created
+# For more information see: https://help.github.com/en/actions/language-and-framework-guides/using-python-with-github-actions#publishing-to-package-registries
+
+name: Upload Python Package to testpypi
+
+on: workflow_dispatch
+
+jobs:
+  deploy:
+    runs-on: ubuntu-18.04
+
+    steps:
+      - uses: actions/checkout@v2
+      - name: Set up Python
+        uses: actions/setup-python@v2
+        with:
+          python-version: 3.9
+      - name: Install dependencies
+        run: |
+          pip install setuptools wheel twine
+          if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
+      - name: Build and publish
+        env:
+          TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }}
+          TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }}
+        run: |
+          python setup.py sdist bdist_wheel
+          twine upload -r testpypi  dist/*