Skip to content

Commit

Permalink
#180: Prepare release on pypi (#181)
Browse files Browse the repository at this point in the history
* Add a exaslct script to pyproject.toml which gets installed during package install
* Change release trigger from release_droid to creating a tag
  • Loading branch information
tkilias authored Mar 20, 2023
1 parent f328a41 commit 0c54e73
Show file tree
Hide file tree
Showing 8 changed files with 111 additions and 94 deletions.
34 changes: 30 additions & 4 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -1,22 +1,48 @@
name: Release
name: Build & Publish

on:
release:
types: [published]
push:
tags: '**'

jobs:

publish-release:
runs-on: ubuntu-latest
environment: publish

steps:
- uses: actions/checkout@v3

- name: SCM Checkout
uses: actions/checkout@v3

- name: Setup Python & Poetry Environment
uses: ./.github/actions/prepare_poetry_env

- name: Build Artifacts
run: poetry build

- name: Build new Docker image
run: "bash scripts/build/build_docker_runner_image.sh"

- name: Docker login
run: echo "$SECRET_DOCKER_TOKEN" | docker login --username "$SECRET_DOCKER_USER_NAME" --password-stdin
env: # Set the secret as an input
SECRET_DOCKER_USER_NAME: ${{ secrets.DOCKER_USER_NAME }}
SECRET_DOCKER_TOKEN: ${{ secrets.DOCKER_TOKEN }}

- name: Push new Docker images
run: bash scripts/build/push_docker_runner_image.sh latest "${{ github.event.release.tag_name }}"

- name: PyPi Release
env:
POETRY_HTTP_BASIC_PYPI_USERNAME: "__token__"
POETRY_HTTP_BASIC_PYPI_PASSWORD: "${{ secrets.PYPI_TOKEN }}"
run: poetry publish

- name: GitHub Release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: >
gh release create ${GITHUB_REF_NAME}
--title ${GITHUB_REF_NAME} -F "./doc/changes/changes_${GITHUB_REF_NAME}.md"
dist/*
86 changes: 0 additions & 86 deletions .github/workflows/release_droid_upload_github_release_assets.yml

This file was deleted.

5 changes: 3 additions & 2 deletions doc/changes/changes_0.16.0.md
Original file line number Diff line number Diff line change
@@ -1,15 +1,16 @@
# Script-Languages-Container-Tool 0.16.0, released 2023-03-17

Code name: Add missing PYTHON3 to the add_missing_builtin option for the LanguageDefinition class
Code name: Bugfix in LanguageDefinition class and prepare for pypi release.

## Summary

This release fix a bug where PYTHON3 was missing when the LanguageDefinition class was called with add_missing_builtin.
This release fix a bug where PYTHON3 was missing when the LanguageDefinition class was called with add_missing_builtin. It also prepares the project for the pypi release.

## Features / Enhancements

- #175: Update vagrant environment
- #178: Install exasol-integration-test-docker-environment from pypi
- #180: Prepare for pypi release

## Refactorings

Expand Down
54 changes: 53 additions & 1 deletion doc/developer_guide/developer_guide.md
Original file line number Diff line number Diff line change
Expand Up @@ -219,4 +219,56 @@ Other build arguments which only influence the resources
which are used to build the image are not part of the final hash.
The `BuildContextHasher` hashes the execution rights of files,
because these are the only rights which get saved in git and
can be important for the images.
can be important for the images.

## Creating a release

### Prerequisites

* Change log needs to be up to date
* Latest change log version needs to match project and package version
* Release tag needs to match package, changelog and project version
* For Example:
* Tag: 0.4.0
* Changelog: changes_0.4.0.md
* \`poetry version -s\`: 0.4.0

### Triggering the Release
In order to trigger a release a new tag must be pushed to Github.
For further details see: `.github/workflows/release.yml`.


1. Create a local tag with the appropriate version number

git tag x.y.z

2. Push the tag to Github

git push origin x.y.z

### What to do if the release failed?

#### The release failed during pre-release checks

1. Delete the local tag

git tag -d x.y.z

2. Delete the remote tag

git push --delete origin x.y.z

3. Fix the issue(s) which lead to the failing checks
4. Start the release process from the beginning


#### One of the release steps failed (Partial Release)

1. Check the Github action/workflow to see which steps failed
2. Finish or redo the failed release steps manually

**Example**:

_Scenario_: Publishing of the release on Github was successfully but during the PyPi release, the upload step got interrupted.

_Solution_: Manually push the package to PyPi
6 changes: 5 additions & 1 deletion exasol_script_languages_container_tool/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,9 @@
import exasol_script_languages_container_tool.cli.commands


if __name__ == '__main__':
def main():
cli()


if __name__ == '__main__':
main()
4 changes: 4 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -29,3 +29,7 @@ build-backend = "poetry.core.masonry.api"

[tool.poetry.dev-dependencies]
toml = ">=0.10.2"


[tool.poetry.scripts]
exaslct = 'exasol_script_languages_container_tool.main:main'
5 changes: 5 additions & 0 deletions setup.py

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

11 changes: 11 additions & 0 deletions test/test_console_script.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import subprocess
import unittest


class ConsoleScriptTest(unittest.TestCase):

def test_console_script(self):
return_code = subprocess.call("poetry install", shell=True)
self.assertEqual(0, return_code, "Poetry install failed")
return_code = subprocess.call("poetry run exaslct --help", shell=True)
self.assertEqual(0, return_code)

0 comments on commit 0c54e73

Please sign in to comment.