Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(ci): add release please and fernignore #3

Merged
merged 2 commits into from
Dec 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .fernignore
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
# Specify files that shouldn't be modified by Fern
.github/workflows/release.yml
.github/workflows/conventional-pr.yml
32 changes: 32 additions & 0 deletions .github/workflows/conventional-pr.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
name: conventional-pr
"on":
pull_request:
branches:
- main
types:
- opened
- edited
- synchronize
jobs:
lint-pr:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- name: Generate a token
id: generate-token
uses: actions/create-github-app-token@v1
with:
app-id: ${{ secrets.SOFERAI_BOT_CLIENT_ID }}
private-key: ${{ secrets.SOFERAI_BOT_PRIVATE_SIGNING_KEY }}

- uses: CondeNast/[email protected]
env:
GITHUB_TOKEN: ${{ steps.generate-token.outputs.token }}
with:
# to override config-conventional rules, specify a relative path to your rules module, actions/checkout is required for this setting!
# commitlintRulesPath: './commitlint.rules.js' # default: undefined
# if the PR contains a single commit, fail if the commit message and the PR title do not match
commitTitleMatch: 'true' # default: 'true'
# if you squash merge PRs and enabled "Default to PR title for squash merge commits", you can disable all linting of commits
ignoreCommits: 'true' # default: 'false'
70 changes: 70 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
# yamllint disable rule:line-length
"on":
push:
branches:
- main

permissions:
contents: write
pull-requests: write

name: release-please

# env is a set of environment variables that are available to all jobs in the workflow.
env:
RUFF_OUTPUT_FORMAT: github
PYTHON_VERSION: "3.12"

jobs:
release-please:
runs-on: ubuntu-22.04
outputs:
release_created: ${{ steps.release.outputs.release_created }}
tag_name: ${{ steps.release.outputs.tag_name }}
major: ${{ steps.release.outputs.major }}
minor: ${{ steps.release.outputs.minor }}
patch: ${{ steps.release.outputs.patch }}

steps:
- name: Generate a token
id: generate-token
uses: actions/create-github-app-token@v1
with:
app-id: ${{ secrets.SOFERAI_BOT_CLIENT_ID }}
private-key: ${{ secrets.SOFERAI_BOT_PRIVATE_SIGNING_KEY }}

- uses: googleapis/release-please-action@v4
id: release
with:
token: ${{ steps.generate-token.outputs.token }}
release-type: python
# Setting target-branch allows us to track multiple release branches
# (should we need to maintain a 1.x or similar branch.)
target-branch: ${{ github.ref_name }}

pypi-publish:
name: upload release to PyPI
needs: release-please
if: ${{ needs.release-please.outputs.release_created }}
runs-on: ubuntu-22.04
# Specifying a GitHub environment is optional, but strongly encouraged
environment: pypi
permissions:
# IMPORTANT: this permission is mandatory for trusted publishing
id-token: write
steps:
# retrieve your distributions here
- uses: actions/checkout@v4

- uses: actions/setup-python@v5
with:
python-version: ${{ env.PYTHON_VERSION }}

- name: "Install uv"
run: curl -LsSf https://astral.sh/uv/install.sh | sh

# - name: Build with uv
# run: uv build

# - name: Publish package distributions to PyPI
# uses: pypa/gh-action-pypi-publish@release/v1
Loading