diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 1357dcb..f1d0636 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -4,12 +4,17 @@ on: branches: [main] pull_request: +permissions: + contents: read + jobs: build-and-test: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v6 - - uses: actions/setup-node@v6 + - uses: actions/checkout@d23441a48e516b6c34aea4fa41551a30e30af803 # v6.1.0 + with: + persist-credentials: false + - uses: actions/setup-node@249970729cb0ef3589644e2896645e5dc5ba9c38 # v6.5.0 with: node-version: '24' cache: 'npm' diff --git a/.github/workflows/pages.yml b/.github/workflows/pages.yml index d8abb63..d0ff9a8 100644 --- a/.github/workflows/pages.yml +++ b/.github/workflows/pages.yml @@ -7,8 +7,6 @@ on: permissions: contents: read - pages: write - id-token: write # Only allow one concurrent deployment concurrency: @@ -20,10 +18,12 @@ jobs: runs-on: ubuntu-latest steps: - name: Checkout - uses: actions/checkout@v6 + uses: actions/checkout@d23441a48e516b6c34aea4fa41551a30e30af803 # v6.1.0 + with: + persist-credentials: false - name: Setup Node - uses: actions/setup-node@v6 + uses: actions/setup-node@249970729cb0ef3589644e2896645e5dc5ba9c38 # v6.5.0 with: node-version: '24' cache: 'npm' @@ -41,17 +41,21 @@ jobs: --base-href /grapesjs-angular/ - name: Upload Pages artifact - uses: actions/upload-pages-artifact@v5 + uses: actions/upload-pages-artifact@fc324d3547104276b827a68afc52ff2a11cc49c9 # v5.0.0 with: path: dist/demo/browser deploy: needs: build runs-on: ubuntu-latest + permissions: + contents: read + pages: write + id-token: write environment: name: github-pages url: ${{ steps.deployment.outputs.page_url }} steps: - name: Deploy to GitHub Pages id: deployment - uses: actions/deploy-pages@v5 \ No newline at end of file + uses: actions/deploy-pages@368f82528645a54fb793d4d04e342629a3f51346 # v5.0.1 diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 5a3b1e4..e07d481 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -3,21 +3,50 @@ on: push: tags: ['v*.*.*'] +permissions: + contents: read + +# Dependency code runs only in `build`; the write-scoped `publish` job installs nothing. jobs: + build: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@d23441a48e516b6c34aea4fa41551a30e30af803 # v6.1.0 + with: + persist-credentials: false + - uses: actions/setup-node@249970729cb0ef3589644e2896645e5dc5ba9c38 # v6.5.0 + with: + node-version: '24' + cache: 'npm' + - run: npm ci + - run: npm run build:lib + - uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1 + with: + name: package + path: dist/grapesjs-angular + # The package's .npmignore keeps nested package.json files out of the tarball. + include-hidden-files: true + retention-days: 1 + publish: + needs: build runs-on: ubuntu-latest permissions: contents: write id-token: write steps: - - uses: actions/checkout@v6 - - uses: actions/setup-node@v6 + - uses: actions/checkout@d23441a48e516b6c34aea4fa41551a30e30af803 # v6.1.0 + with: + persist-credentials: false + - uses: actions/setup-node@249970729cb0ef3589644e2896645e5dc5ba9c38 # v6.5.0 with: node-version: '24' registry-url: 'https://registry.npmjs.org' - cache: 'npm' - - run: npm ci - - run: npm run build:lib + package-manager-cache: false + - uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1 + with: + name: package + path: dist/grapesjs-angular - name: Detect pre-release id: meta run: | @@ -32,7 +61,7 @@ jobs: # every tag publishes to the `latest` dist-tag (npm's default). Revisit once # a stable release needs its own pre-release channel — e.g. route betas to # `next` and reserve `latest` for stable. - - run: npm publish ./dist/grapesjs-angular --access public --provenance --tag latest + - run: npm publish ./dist/grapesjs-angular --access public --provenance --tag latest --ignore-scripts - name: Create GitHub Release env: