Skip to content

Commit

Permalink
It's like poetry
Browse files Browse the repository at this point in the history
  • Loading branch information
Erik Wallinder-Mahler committed Jun 24, 2024
1 parent d1ab74e commit e88c805
Show file tree
Hide file tree
Showing 7 changed files with 158 additions and 25 deletions.
93 changes: 68 additions & 25 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -1,34 +1,77 @@
name: Release
name: Publish Python Package

on:
push:
tags:
- 'v[0-9]+.[0-9]+.[0-9]+' #Versioning by semantic versioning
- 'v*.*.*'
pull_request:
branches:
- main

jobs:
build:
runs-on: ubuntu-22.04
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Extract and Parse version info from tag
- uses: actions/checkout@v2

- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: '3.x'

- name: Install Poetry
run: |
VERSION=${GITHUB_REF:11}
MAJOR=$(echo "$VERSION" | cut -d. -f1)
MINOR=$(echo "$VERSION" | cut -d. -f2)
PATCH=$(echo "$VERSION" | cut -d. -f3)
echo "version=$VERSION" >> $GITHUB_ENV
echo "version_major=$MAJOR" >> $GITHUB_ENV
echo "version_minor=$MINOR" >> $GITHUB_ENV
echo "version_patch=$PATCH" >> $GITHUB_ENV
- name: Build and Push Docker Image
curl -sSL https://install.python-poetry.org | python3 -
echo "${HOME}/.local/bin" >> $GITHUB_PATH
- name: Configure Poetry
run: |
IMG=ghcr.io/${{ github.repository }}
docker build \
--tag $IMG:${{ env.version }} \
--tag $IMG:${{ env.version_major }}.${{ env.version_minor }}.${{ env.version_patch }} \
--tag $IMG:${{ env.version_major }}.${{ env.version_minor }}.latest \
--tag $IMG:${{ env.version_major }}.latest \
--tag $IMG:latest \
.
docker push --all-tags $IMG
- name: Registry Login (ghcr.io)
poetry config virtualenvs.create false
- name: Install dependencies
run: poetry install

publish:
needs: build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2

- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: '3.x'

- name: Install Poetry
run: |
echo "${{ secrets.GH_TOKEN }}" | docker login ghcr.io -u ${{ github.actor }} --password-stdin
curl -sSL https://install.python-poetry.org | python3 -
echo "${HOME}/.local/bin" >> $GITHUB_PATH
- name: Install dependencies
run: poetry install

- name: Build package
run: poetry build

- name: Publish package to PyPI
env:
POETRY_PYPI_TOKEN: ${{ secrets.PYPI_TOKEN }}
run: poetry publish --username __token__ --password $POETRY_PYPI_TOKEN

release:
needs: [build, publish]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2

- name: Create GitHub Release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ github.ref }}
release_name: Release ${{ github.ref }}
draft: false
prerelease: false
50 changes: 50 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
dist/
# Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]
*$py.class

# Distribution / packaging
build/
dist/
*.egg-info/
.eggs/

# Installer logs
pip-log.txt
pip-delete-this-directory.txt

# Test / coverage reports
.coverage
.tox/
.nox/
.cache
nosetests.xml
coverage.xml
*.cover
*.py,cover
.hypothesis/

# Jupyter Notebook
.ipynb_checkpoints

# Environments
.env
.venv
env/
venv/
ENV/
env.bak/
venv.bak/

# PyCharm
.idea/

# VS Code
.vscode/

# mypy
.mypy_cache/

# Pytest
.pytest_cache/
Empty file added LICENSE
Empty file.
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Versioning tool for REMLA frontend

Installs using Poetry
22 changes: 22 additions & 0 deletions poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

15 changes: 15 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
[tool.poetry]
name = "remlaversionutilpy"
version = "0.1.2"
description = "Versioning for REMLA frontend"
authors = ["Erik Wallinder-Mahler <[email protected]>"]
readme = "README.md"

[tool.poetry.dependencies]
python = "^3.11"
setuptools = "69.5.1"


[build-system]
requires = ["poetry-core"]
build-backend = "poetry.core.masonry.api"
File renamed without changes.

0 comments on commit e88c805

Please sign in to comment.