From 5a55219aa5b3dee5eb11110b4b460e3e5b28fde4 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Sat, 30 Sep 2023 07:15:08 +0000 Subject: [PATCH 1/2] chore(deps): update dependency knope to v0.12.0 --- .github/workflows/prerelease.yml | 2 +- .github/workflows/release-dry-run.yml | 2 +- .github/workflows/release.yml | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/prerelease.yml b/.github/workflows/prerelease.yml index 70bbd0a6a..2eaa22fca 100644 --- a/.github/workflows/prerelease.yml +++ b/.github/workflows/prerelease.yml @@ -26,7 +26,7 @@ jobs: - name: Install Knope uses: knope-dev/action@v2.0.0 with: - version: 0.11.0 + version: 0.12.0 - name: Bump Version & Create GitHub Release run: knope release --prerelease-label="${{ github.event.inputs.label }}" env: diff --git a/.github/workflows/release-dry-run.yml b/.github/workflows/release-dry-run.yml index a664b8d76..d96876ce7 100644 --- a/.github/workflows/release-dry-run.yml +++ b/.github/workflows/release-dry-run.yml @@ -16,5 +16,5 @@ jobs: - name: Install Knope uses: knope-dev/action@v2.0.0 with: - version: 0.11.0 + version: 0.12.0 - run: knope release --dry-run diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 3bd5b3d20..2f64a5d0c 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -20,7 +20,7 @@ jobs: - name: Install Knope uses: knope-dev/action@v2.0.0 with: - version: 0.11.0 + version: 0.12.0 - name: Bump Version & Create GitHub Release run: knope release env: From c2ef8ea4c21e6cb9c68a36f44566c012428e92a9 Mon Sep 17 00:00:00 2001 From: Dylan Anthony Date: Sat, 14 Oct 2023 10:24:10 -0600 Subject: [PATCH 2/2] ci: Move to PR-driven releases --- .github/workflows/codeql-analysis.yml | 39 ------------------- .github/workflows/prerelease.yml | 37 ------------------ .github/workflows/preview_release_pr.yml | 24 ++++++++++++ .github/workflows/release-dry-run.yml | 3 -- .github/workflows/release.yml | 21 +++++------ knope.toml | 48 ++++++++++++++++++++++++ 6 files changed, 81 insertions(+), 91 deletions(-) delete mode 100644 .github/workflows/codeql-analysis.yml delete mode 100644 .github/workflows/prerelease.yml create mode 100644 .github/workflows/preview_release_pr.yml create mode 100644 knope.toml diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml deleted file mode 100644 index c222ab9e0..000000000 --- a/.github/workflows/codeql-analysis.yml +++ /dev/null @@ -1,39 +0,0 @@ -name: "CodeQL" - -on: - push: - branches: [main, ] - pull_request: - # The branches below must be a subset of the branches above - branches: [main] - schedule: - - cron: '0 23 * * 2' - merge_group: - -jobs: - analyze: - name: Analyze - runs-on: ubuntu-latest - - steps: - - name: Checkout repository - uses: actions/checkout@3df4ab11eba7bda6032a0b82a6bb43b11571feac # v4 - with: - # We must fetch at least the immediate parents so that if this is - # a pull request then we can checkout the head. - fetch-depth: 2 - - # If this run was triggered by a pull request event, then checkout - # the head of the pull request instead of the merge commit. - - run: git checkout HEAD^2 - if: ${{ github.event_name == 'pull_request' }} - - # Initializes the CodeQL tools for scanning. - - name: Initialize CodeQL - uses: github/codeql-action/init@v2 - # Override language selection by uncommenting this and choosing your languages - with: - languages: python - - - name: Perform CodeQL Analysis - uses: github/codeql-action/analyze@v2 diff --git a/.github/workflows/prerelease.yml b/.github/workflows/prerelease.yml deleted file mode 100644 index 2eaa22fca..000000000 --- a/.github/workflows/prerelease.yml +++ /dev/null @@ -1,37 +0,0 @@ -name: Prerelease - -on: - workflow_dispatch: - inputs: - label: - description: 'Prerelease label for the release' - required: true - -jobs: - create-release: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@3df4ab11eba7bda6032a0b82a6bb43b11571feac # v4 - with: - fetch-depth: 0 - token: ${{ secrets.PAT }} - - uses: Swatinem/rust-cache@v2 - - name: Import GPG key - uses: crazy-max/ghaction-import-gpg@v6 - with: - gpg_private_key: ${{ secrets.GPG_PRIVATE_KEY }} - git_user_signingkey: true - git_commit_gpgsign: true - git_push_gpgsign: false - - name: Install Knope - uses: knope-dev/action@v2.0.0 - with: - version: 0.12.0 - - name: Bump Version & Create GitHub Release - run: knope release --prerelease-label="${{ github.event.inputs.label }}" - env: - GITHUB_TOKEN: ${{ secrets.PAT }} - - name: Install Poetry - run: pip install --upgrade poetry - - name: Push to PyPI - run: poetry publish --build -u __token__ -p ${{ secrets.PYPI_TOKEN }} diff --git a/.github/workflows/preview_release_pr.yml b/.github/workflows/preview_release_pr.yml new file mode 100644 index 000000000..b8c18bd7c --- /dev/null +++ b/.github/workflows/preview_release_pr.yml @@ -0,0 +1,24 @@ +on: + push: + branches: [main] +name: Create Release PR +jobs: + prepare-release: + if: "!contains(github.event.head_commit.message, 'chore: prepare release')" # Skip merges from releases + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + with: + fetch-depth: 0 + token: ${{ secrets.PAT }} + - name: Configure Git + run: | + git config --global user.name GitHub Actions + git config user.email github-actions@github.com + - uses: knope-dev/action@v2.0.0 + with: + version: 0.12.0 + - run: knope prepare-release --verbose + env: + GITHUB_TOKEN: ${{ secrets.PAT }} + continue-on-error: true diff --git a/.github/workflows/release-dry-run.yml b/.github/workflows/release-dry-run.yml index d96876ce7..303dec2d0 100644 --- a/.github/workflows/release-dry-run.yml +++ b/.github/workflows/release-dry-run.yml @@ -1,9 +1,6 @@ name: Release Dry Run on: - push: - branches: - - main pull_request: jobs: release: diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 2f64a5d0c..6cb5d007b 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -1,31 +1,28 @@ name: Release -on: workflow_dispatch +on: + pull_request: + types: [closed] + branches: [main] jobs: release: + if: github.head_ref == 'release' && github.event.pull_request.merged == true runs-on: ubuntu-latest steps: - uses: actions/checkout@3df4ab11eba7bda6032a0b82a6bb43b11571feac # v4 with: fetch-depth: 0 token: ${{ secrets.PAT }} - - name: Import GPG key - uses: crazy-max/ghaction-import-gpg@v6 - with: - gpg_private_key: ${{ secrets.GPG_PRIVATE_KEY }} - git_user_signingkey: true - git_commit_gpgsign: true - git_push_gpgsign: false - name: Install Knope uses: knope-dev/action@v2.0.0 with: version: 0.12.0 - - name: Bump Version & Create GitHub Release - run: knope release - env: - GITHUB_TOKEN: ${{ secrets.PAT }} - name: Install Poetry run: pip install --upgrade poetry - name: Push to PyPI run: poetry publish --build -u __token__ -p ${{ secrets.PYPI_TOKEN }} + - name: Create GitHub Release + run: knope release + env: + GITHUB_TOKEN: ${{ secrets.PAT }} diff --git a/knope.toml b/knope.toml new file mode 100644 index 000000000..6042399c2 --- /dev/null +++ b/knope.toml @@ -0,0 +1,48 @@ +[package] +versioned_files = ["pyproject.toml"] +changelog = "CHANGELOG.md" + +[[workflows]] +name = "prepare-release" + +[[workflows.steps]] +type = "Command" +command = "git switch -c release" + +[[workflows.steps]] +type = "PrepareRelease" + +[[workflows.steps]] +type = "Command" +command = "git commit -m \"chore: prepare release $version\" && git push --force --set-upstream origin release" + +[workflows.steps.variables] +"$version" = "Version" + +[[workflows.steps]] +type = "CreatePullRequest" +base = "main" + +[workflows.steps.title] +template = "chore: prepare release $version" +variables = { "$version" = "Version" } + +[workflows.steps.body] +template = "This PR was created by Knope. Merging it will create a new release\n\n$changelog" +variables = { "$changelog" = "ChangelogEntry" } + +[[workflows]] +name = "release" + +[[workflows.steps]] +type = "Release" + +[[workflows]] +name = "document-change" + +[[workflows.steps]] +type = "CreateChangeFile" + +[github] +owner = "openapi-generators" +repo = "openapi-python-client"