diff --git a/.github/workflows/ci.yml b/.github/workflows/backend-ci.yml similarity index 100% rename from .github/workflows/ci.yml rename to .github/workflows/backend-ci.yml diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index bb8f4b4..227d6b2 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -5,11 +5,11 @@ on: branches: [main] jobs: - run_tests: - uses: ./.github/workflows/ci.yml + run_backend_tests: + uses: ./.github/workflows/backend-ci.yml release: - needs: run_tests + needs: run_backend_tests runs-on: ubuntu-latest if: github.ref_name == 'main' concurrency: @@ -27,7 +27,7 @@ jobs: # while the workflow was running, which prevents accidentally releasing un-evaluated # changes. - name: Setup | Checkout Repository on Release Branch - uses: actions/checkout@v4 + uses: actions/checkout@v6 with: ref: ${{ github.ref_name }} @@ -64,8 +64,9 @@ jobs: outputs: released: ${{ steps.release.outputs.released || 'false' }} + version: ${{ steps.release.outputs.version }} - publish: + publish_to_pypi: # 1. Separate out the publish step from the github release step to run each step at # the least amount of token privilege # 2. Also, publishing can fail, and its better to have a separate job if you need to retry @@ -92,3 +93,28 @@ jobs: packages-dir: backend/dist user: __token__ password: ${{ secrets.PYPI_UPLOAD_TOKEN }} + + publish_to_npm: + runs-on: ubuntu-latest + needs: release + if: github.ref_name == 'main' && needs.release.outputs.released == 'true' + permissions: + contents: read + id-token: write + + steps: + - name: Setup | Checkout Repository on Release Ref + uses: actions/checkout@v6 + with: + ref: ${{ github.sha }} + + - name: Setup Node.js + uses: actions/setup-node@v6 + with: + node-version-file: './frontend/.nvmrc' + + - name: Update the package version and publish + run: | + npm version ${{ needs.release.outputs.version }} + npm publish + working-directory: './frontend' diff --git a/frontend/package.json b/frontend/package.json index 9892fbc..0bb3626 100644 --- a/frontend/package.json +++ b/frontend/package.json @@ -1,6 +1,6 @@ { "name": "@openedx/sample-plugin", - "version": "0.0.1", + "version": "__semantically__released__", "main": "src/index.jsx", "peerDependencies": { "@edx/frontend-platform": "*",