diff --git a/.github/workflows/pythonpublish.yml b/.github/workflows/pythonpublish.yml deleted file mode 100644 index 839849307..000000000 --- a/.github/workflows/pythonpublish.yml +++ /dev/null @@ -1,24 +0,0 @@ -name: Upload Python Package - -on: - release: - types: [created] - -jobs: - deploy: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v3 - - name: Set up Python - uses: actions/setup-python@v4 - with: - python-version: '3.x' - - name: Install dependencies - run: | - python -m pip install --upgrade pip - pip install --upgrade poetry - poetry install --no-dev - poetry config http-basic.pypi __token__ ${{ secrets.PYPI_TOKEN }} - - name: Build and publish - run: | - poetry publish --build diff --git a/.github/workflows/release-dry-run.yml b/.github/workflows/release-dry-run.yml new file mode 100644 index 000000000..df9323dec --- /dev/null +++ b/.github/workflows/release-dry-run.yml @@ -0,0 +1,26 @@ +name: Release Dry Run + +on: + push: + branches: + - main + +jobs: + release: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + with: + fetch-depth: 0 + token: ${{ secrets.PAT }} + - uses: actions-rs/toolchain@v1 + with: + profile: minimal + toolchain: stable + - uses: Swatinem/rust-cache@v1 + - name: Install Knope + uses: actions-rs/cargo@v1 + with: + command: install + args: knope + - run: knope release --dry-run \ No newline at end of file diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 000000000..de699da70 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,40 @@ +name: Release + +on: workflow_dispatch + +jobs: + release: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + with: + fetch-depth: 0 + token: ${{ secrets.PAT }} + - name: Import GPG key + uses: crazy-max/ghaction-import-gpg@v5 + with: + gpg_private_key: ${{ secrets.GPG_PRIVATE_KEY }} + git_user_signingkey: true + git_commit_gpgsign: true + git_push_gpgsign: false + - uses: actions-rs/toolchain@v1 + with: + profile: minimal + toolchain: stable + - uses: Swatinem/rust-cache@v1 + - name: Install Knope + uses: actions-rs/cargo@v1 + with: + command: install + args: knope + - name: Bump Version & Create GitHub Release + run: knope release + env: + GITHUB_TOKEN: ${{ secrets.PAT }} + - name: Setup Poetry + run: | + python -m pip install --upgrade pip + pip install --upgrade poetry + poetry config http-basic.pypi __token__ ${{ secrets.PYPI_TOKEN }} + - name: Push to PyPI + run: poetry publish --build diff --git a/knope.toml b/knope.toml index a57769571..3e0214bb5 100644 --- a/knope.toml +++ b/knope.toml @@ -19,6 +19,22 @@ name = "release" type = "Command" command = "npx prettier --write CHANGELOG.md" + [[workflows.steps]] + type = "Command" + command = "git add pyproject.toml CHANGELOG.md" + + [[workflows.steps]] + type = "Command" + command = "git commit -m \"chore: Bump to version\"" + variables = { "version" = "Version" } + + [[workflows.steps]] + type = "Command" + command = "git push" + + [[workflows.steps]] + type = "Release" + [github] owner = "openapi-generators" repo = "openapi-python-client"