diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml index 7161216..d9ba7f7 100644 --- a/.github/workflows/CI.yml +++ b/.github/workflows/CI.yml @@ -7,8 +7,8 @@ permissions: pull-requests: write jobs: - 'test-frontend': - name: Test Frontend + 'build-frontend': + name: Build Frontend runs-on: ubuntu-latest steps: - name: Checkout Repo @@ -23,8 +23,6 @@ jobs: - name: Build run: npm run build - - name: Test - run: npm run test # Upload the entire workspace - name: Upload entire workspace uses: actions/upload-artifact@v4 @@ -32,6 +30,29 @@ jobs: name: workspace path: . # retention-days: 1 + 'test-frontend': + name: Test Frontend + needs: ['build-frontend'] + + runs-on: ubuntu-latest + steps: + - name: Checkout Repo + uses: actions/checkout@v4 + # Download the entire workspace + - name: Download workspace + uses: actions/download-artifact@v4 + with: + name: workspace + path: . + + - name: Install Node.JS + uses: actions/setup-node@v4 + + - name: Install dependencies + run: npm ci + + - name: Test + run: npm run test 'test-backend': runs-on: ubuntu-latest @@ -107,42 +128,49 @@ jobs: GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}} release: - name: Release - if: "startsWith(github.ref, 'refs/tags/')" runs-on: ubuntu-latest - needs: ['test-backend', 'test-frontend'] - - steps: - - name: Checkout Repo - uses: actions/checkout@v4 - - # Download the entire workspace - - name: Download workspace - uses: actions/download-artifact@v4 - with: - name: workspace - path: . + if: "startsWith(github.ref, 'refs/tags/')" + needs: ['test-frontend', 'test-backend'] - - name: Install Python - uses: actions/setup-python@v5 - with: - python-version: 3.13 + environment: + name: pypi + url: https://pypi.org/project/django-hstore-widget + permissions: + contents: write + id-token: write # IMPORTANT: this permission is mandatory for trusted publishing + steps: - uses: actions/checkout@v4 - name: Install Poetry uses: snok/install-poetry@v1 with: virtualenvs-create: true virtualenvs-in-project: true + # Download the entire workspace + - name: Download workspace + uses: actions/download-artifact@v4 + with: + name: workspace + path: . - # - name: Install python dependencies - # run: | - # poetry install --sync --no-interaction --no-root - - - name: Set pypi token + - name: Install python dependencies run: | poetry config pypi-token.pypi ${{ secrets.PYPI_TOKEN }} + # Upload the .whl file to the GitHub Release - - name: Publish - run: | - poetry publish --build + - name: Build the dependency + run: poetry build --output py-dist + + - name: Upload package to release + uses: svenstaro/upload-release-action@v2 + with: + repo_token: ${{ secrets.GITHUB_TOKEN }} + file: py-dist/* + tag: ${{ github.ref }} + overwrite: true + file_glob: true + + - name: Publish package distributions to PyPI + uses: pypa/gh-action-pypi-publish@release/v1 + with: + packages-dir: py-dist/ diff --git a/pyproject.toml b/pyproject.toml index a1f2403..5f7d063 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [tool.poetry] name = "django-hstore-widget" -version = "0.0.9" +version = "0.0.10" description = "Human friendly HStoreWidget. Continual of django-admin-hstore-widget." authors = [ "Alexandre Dufour ",