Skip to content

💥 pydantic v2 #47

💥 pydantic v2

💥 pydantic v2 #47

Workflow file for this run

name: Release
on:
push:
branches: [main, next, beta, alpha, '*.x']
jobs:
release:
name: Release
if: github.repository_owner == 'juftin'
runs-on: ubuntu-latest
permissions:
contents: write
issues: write
pull-requests: write
steps:
- name: Check out the repository
uses: actions/checkout@v4
with:
fetch-depth: 2
- name: Setup Node.js
uses: actions/setup-node@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.11'
- name: Install Hatch
run: |
python -m pip install --upgrade pip
python -m pip install -q hatch pre-commit
hatch --version
- name: Release
run: hatch run gen:release
env:
GITHUB_TOKEN: ${{ secrets.PERSONAL_ACCESS_TOKEN }}
GIT_AUTHOR_NAME: github-actions[bot]
GIT_AUTHOR_EMAIL: github-actions[bot]@users.noreply.github.com
GIT_COMMITTER_NAME: github-actions[bot]
GIT_COMMITTER_EMAIL: github-actions[bot]@users.noreply.github.com
github-pages-publish:
needs: release
if: github.ref == 'refs/heads/main' && github.repository_owner == 'juftin'
runs-on: ubuntu-latest
steps:
- name: Checkout Latest Changes
uses: actions/checkout@v3
with:
path: ${{ github.workspace }}/main
ref: ${{ github.ref }}
fetch-depth: 0
- name: Create gh-pages if not exists
working-directory: ${{ github.workspace }}/main
run: |
git checkout gh-pages || git checkout -b gh-pages
git push --set-upstream origin gh-pages || true
git checkout main --
- name: Checkout gh-pages Branch
uses: actions/checkout@v4
with:
path: ${{ github.workspace }}/github-pages
ref: gh-pages
fetch-depth: 0
- name: Set up Python Environment
uses: actions/setup-python@v5
with:
python-version: '3.11'
- name: Install Hatch
working-directory: ${{ github.workspace }}/main
run: |
python -m pip install --upgrade pip
python -m pip install -q hatch
hatch --version
- name: Documentation Generation
working-directory: ${{ github.workspace }}/main
run: |
hatch run docs:build
- name: Setup Git Config
run: |
git config --global user.name "github-actions[bot]"
git config --global user.email "github-actions[bot]@users.noreply.github.com"
- name: Get Commit SHA from main
working-directory: ${{ github.workspace }}/main
run: |
COMMIT_SHA=$(git rev-parse HEAD)
PROJECT_VERSION=$(hatch version)
echo PROJECT_VERSION=${PROJECT_VERSION} >> $GITHUB_ENV
echo "COMMIT_SHA=${COMMIT_SHA}" >> ${GITHUB_ENV}
- name: Commit Changes to gh-pages Branch
working-directory: ${{ github.workspace }}/github-pages
run: |
git rm -rf . || true
cp -R ${{ github.workspace }}/main/docs/_build/html/* ${PWD}
touch .nojekyll
cp ${{ github.workspace }}/main/docs/README.md .
git add .
git diff-index --quiet HEAD || git commit -m "GitHub Pages - ${{ env.PROJECT_VERSION }} - ${{ env.COMMIT_SHA }}"
git push origin gh-pages --force