From da0a3ebefae06728b2c3783c183a69d572042bae Mon Sep 17 00:00:00 2001 From: Sergei Maertens Date: Thu, 2 May 2024 23:01:22 +0200 Subject: [PATCH] :construction_worker: Publish npm package with github actions --- .github/actions/build-js/action.yml | 1 + .github/workflows/release.yml | 26 +++++++++++++++++++------- 2 files changed, 20 insertions(+), 7 deletions(-) diff --git a/.github/actions/build-js/action.yml b/.github/actions/build-js/action.yml index ef916d2..39fc407 100644 --- a/.github/actions/build-js/action.yml +++ b/.github/actions/build-js/action.yml @@ -24,6 +24,7 @@ runs: node-version-file: 'js/.nvmrc' cache: npm cache-dependency-path: js/package-lock.json + registry-url: 'https://npm.pkg.github.com' - name: Install dependencies run: npm ci diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 4c82528..750df21 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -2,6 +2,8 @@ name: Release on: push: + branches: + - feature/isolate-js tags: - '*' @@ -11,6 +13,10 @@ jobs: runs-on: ubuntu-latest if: github.repository == 'jazzband/django-cookie-consent' + permissions: + contents: read + packages: write + steps: - uses: actions/checkout@v3 with: @@ -37,10 +43,16 @@ jobs: python setup.py sdist --format=gztar bdist_wheel twine check dist/* - - name: Upload packages to Jazzband - if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags') - uses: pypa/gh-action-pypi-publish@release/v1 - with: - user: jazzband - password: ${{ secrets.JAZZBAND_RELEASE_KEY }} - repository_url: https://jazzband.co/projects/django-cookie-consent/upload + # - name: Upload packages to Jazzband + # if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags') + # uses: pypa/gh-action-pypi-publish@release/v1 + # with: + # user: jazzband + # password: ${{ secrets.JAZZBAND_RELEASE_KEY }} + # repository_url: https://jazzband.co/projects/django-cookie-consent/upload + + - name: Publish NPM package + # if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags') + run: npm pack + env: + NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}