From 0abdf177cfd5856f0e519ca81705414674dc2cc8 Mon Sep 17 00:00:00 2001 From: Serg Shalavin Date: Tue, 16 Apr 2024 18:38:37 +0200 Subject: [PATCH] ci: release github actions (#57) --- .github/release.yml | 16 ++++++++++ .github/workflows/pre_release.yml | 32 +++++++++++++++++++ .github/workflows/release.yml | 53 +++++++++++++++++++++++++++++++ 3 files changed, 101 insertions(+) create mode 100644 .github/release.yml create mode 100644 .github/workflows/pre_release.yml create mode 100644 .github/workflows/release.yml diff --git a/.github/release.yml b/.github/release.yml new file mode 100644 index 00000000..80ec7f99 --- /dev/null +++ b/.github/release.yml @@ -0,0 +1,16 @@ +changelog: + exclude: + labels: + - platform + categories: + - title: Breaking Changes 🛠 + labels: + - Semver-Major + - breaking-change + - title: New Features 🎉 + labels: + - Semver-Minor + - feature + - title: Other Changes + labels: + - "*" \ No newline at end of file diff --git a/.github/workflows/pre_release.yml b/.github/workflows/pre_release.yml new file mode 100644 index 00000000..1b1ebd52 --- /dev/null +++ b/.github/workflows/pre_release.yml @@ -0,0 +1,32 @@ +name: Publish to Test PyPI +on: + workflow_dispatch: + inputs: + PYTHON_VERSION: + description: "Python Version" + required: false + default: "3.10.13" + POETRY_VERSION: + description: "The version of Poetry to use" + required: false + default: "1.8.2" +defaults: + run: + working-directory: ./tools +jobs: + test_pypi_release: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - name: Install poetry + run: pip install poetry==${{ inputs.POETRY_VERSION }} + shell: bash + - name: Set up Python ${{ inputs.PYTHON_VERSION }} + uses: actions/setup-python@v4 + with: + python-version: ${{ inputs.PYTHON_VERSION }} + - run: poetry install + - run: poetry config repositories.testpypi https://test.pypi.org/legacy/ + - run: poetry config pypi-token.testpypi ${{ secrets.TEST_PYPI_TOKEN }} + - name: Publish package + run: poetry publish --build -r testpypi \ No newline at end of file diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 00000000..b65b84f8 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,53 @@ +name: Publish to PyPI +on: + workflow_dispatch: + inputs: + PYTHON_VERSION: + description: "Python Version" + required: false + default: "3.10.13" + POETRY_VERSION: + description: "The version of Poetry to use" + required: false + default: "1.8.2" + RELEASE_TAG: + description: "The new version should be a valid PEP 440 string" + required: true + default: "0.0.1" +defaults: + run: + working-directory: ./tools +jobs: + pypi_release: + name: Builds Using Poetry and Publishes to PyPI + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - name: Install poetry + run: pip install poetry==${{ inputs.POETRY_VERSION }} + shell: bash + - name: Set up Python ${{ inputs.PYTHON_VERSION }} + uses: actions/setup-python@v4 + with: + python-version: ${{ inputs.PYTHON_VERSION }} + - name: Add and Commit Version + run: | + poetry version ${{ inputs.RELEASE_TAG }} + git add ./pyproject.toml + git config --global user.name "Release Bot" + git config --global user.email "cgdevx@cloudgeometry.io" + git commit -m "Change version to ${{ inputs.RELEASE_TAG }}" --allow-empty + git push origin + shell: bash + - run: poetry install + - run: poetry config pypi-token.pypi "${{ secrets.PYPI_TOKEN }}" + - name: Publish package + run: poetry publish --build + - name: Build binary + run: poetry run build + - uses: ncipollo/release-action@v1 + with: + artifacts: "tools/dist/cgdevxcli" + generateReleaseNotes: true + commit: main + tag: ${{ inputs.RELEASE_TAG }}