-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Erik Wallinder-Mahler
committed
Jun 24, 2024
1 parent
d1ab74e
commit e88c805
Showing
7 changed files
with
158 additions
and
25 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
# Versioning tool for REMLA frontend | ||
|
||
Installs using Poetry |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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.