Skip to content

Commit

Permalink
fix: try to fix pragma-utils error into test-pypi job (#149)
Browse files Browse the repository at this point in the history
* feat: add id-token permission

* feat: pypi test publisher, some permissions

* fix: remove reusable workflow from publisher

* feat: let's test

* feat: move publisher.yml into release.yml, remove workflow call

* fix: remove dist/ into root folder

* fix: remove env, url

* fix: add password to pypi_test

* fix: add default working directory

* fix: working directory

* fix: dist path

* fix: dist path, upload complete folder

* fix: dist path, only dist folder

* fix: add verbose

* feat: poetry monorepo plugin

* feat: pre-release workflow for test-pypi, poetry pipeline for publishment

---------

Co-authored-by: 0xevolve <Artevolve@yahoo.com>
  • Loading branch information
hel-kame and EvolveArt authored Jul 17, 2024
1 parent f87b35f commit 1dcda40
Show file tree
Hide file tree
Showing 3 changed files with 46 additions and 58 deletions.
33 changes: 33 additions & 0 deletions .github/workflows/pre-release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
---
name: Task - Publish Package to Test PyPi

on:
push:
branches:
- master

env:
PYTHON_VERSION: 3.12.4

defaults:
run:
working-directory: pragma-sdk

jobs:
test_pypi_publish:
name: Upload package to Test PyPI
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: CfirTsabari/actions-pipx@v1
- name: Install poetry
run: pipx install poetry
- uses: actions/setup-python@v5
with:
python-version: ${{ env.PYTHON_VERSION }}
cache: "poetry"
- run: pipx inject poetry poetry-monorepo-dependency-plugin
- run: poetry config repositories.test-pypi https://test.pypi.org/legacy/
- run: poetry config pypi-token.test-pypi ${{ secrets.TEST_PYPI_API_TOKEN }}
- run: poetry build -f sdist
- run: poetry publish -r test-pypi
68 changes: 10 additions & 58 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -1,19 +1,16 @@
---
name: Task - Publish Package
name: Task - Publish Package to Pypi

on:
workflow_dispatch:
workflow_call:

env:
PYTHON_VERSION: 3.12.4

permissions:
contents: read
defaults:
run:
working-directory: pragma-sdk

jobs:
build_sdist:
name: Build SDist
pypi_publish:
name: Upload package to PyPI
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
Expand All @@ -24,52 +21,7 @@
with:
python-version: ${{ env.PYTHON_VERSION }}
cache: "poetry"

- name: Build SDist
working-directory: ./pragma-sdk/
run: poetry build -f sdist

- uses: actions/upload-artifact@v4
with:
name: sdist
path: pragma-sdk/dist/
if-no-files-found: error

pypi_test_publish:
name: Upload package to Test PyPI
needs: [build_sdist]
runs-on: ubuntu-latest
environment: testpypi
permissions:
id-token: write
steps:
- uses: actions/download-artifact@v4
with:
name: sdist
path: pragma-sdk/dist/

- uses: pypa/gh-action-pypi-publish@release/v1
with:
repository-url: https://test.pypi.org/legacy/
packages-dir: pragma-sdk/dist/
skip-existing: true

pypi_publish:
name: Upload package to PyPI
needs: [build_sdist, pypi_test_publish]
runs-on: ubuntu-latest
environment:
name: pypi
url: https://pypi.org/p/pragma-sdk
permissions:
id-token: write
steps:
- uses: actions/download-artifact@v4
with:
name: sdist
path: pragma-sdk/dist/

- uses: pypa/gh-action-pypi-publish@release/v1
with:
packages-dir: pragma-sdk/dist/
skip-existing: true
- run: pipx inject poetry poetry-monorepo-dependency-plugin
- run: poetry config pypi-token.pypi "${{ secrets.PYPI_API_KEY }}"
- run: poetry build -f sdist
- run: poetry publish
3 changes: 3 additions & 0 deletions pragma-sdk/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -159,3 +159,6 @@ source = ["pragma_sdk"]
[tool.coverage.report]
omit = ["*_test.py", "tests/*"]
skip_empty = true

[tool.poetry-monorepo-dependency-plugin]
enable = true

0 comments on commit 1dcda40

Please sign in to comment.