Skip to content

Commit

Permalink
feat: release on Pypi on version tag
Browse files Browse the repository at this point in the history
  • Loading branch information
armanddidierjean committed Jun 18, 2024
1 parent e78f430 commit 8cf4684
Showing 1 changed file with 23 additions and 20 deletions.
43 changes: 23 additions & 20 deletions .github/workflows/publish.yml → .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -1,13 +1,17 @@
name: Build and publish on branch

name: Build Next project, Python module and publish to Pypi
on:
workflow_dispatch:
push:
branches:
- main
tags:
- "v*.*.*"

jobs:
deploy:
release:
runs-on: ubuntu-latest
timeout-minutes: 10
permissions:
# IMPORTANT: this permission is mandatory for trusted publishing
id-token: write
steps:
- uses: actions/checkout@v4

Expand All @@ -33,21 +37,20 @@ jobs:
restore-keys: |
${{ runner.os }}-nextjs-${{ hashFiles('**/yarn.lock') }}-
- name: Build
- name: Build Next site
run: CI=false yarn build # Using CI=false remove Treat warning as error that make the compilation fail

- name: Prepare build
run: |
mkdir module_build
cp -r out module_build/out
cp -r pyproject.toml module_build/pyproject.toml
cp -r python module_build/python
- name: Deploy
uses: peaceiris/actions-gh-pages@v4
if: github.ref == 'refs/heads/main'
- name: Install Python
uses: actions/setup-python@v4
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./module_build
publish_branch: build
commit_message: ${{ github.event.head_commit.message }}
python-version: "3.11"

- name: Install Hatch
run: pip install hatch

- name: Build Python module
run: hatch build

- name: Publish package distributions to PyPI
# https://docs.pypi.org/trusted-publishers/using-a-publisher/
uses: pypa/gh-action-pypi-publish@release/v1

0 comments on commit 8cf4684

Please sign in to comment.