From 11780221dff335db8a218903055f43148e3568b3 Mon Sep 17 00:00:00 2001 From: Gauthier Fiorentino Date: Wed, 20 Mar 2024 17:01:03 +0100 Subject: [PATCH] CI: Add package publication to workflow --- .github/workflows/CI.yml | 25 +++++++++++++++++++++++++ .npmignore | 34 ++++++++++++++++++++++++++++++++++ package.json | 4 ++++ 3 files changed, 63 insertions(+) create mode 100644 .npmignore diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml index 62a301f..15a516e 100644 --- a/.github/workflows/CI.yml +++ b/.github/workflows/CI.yml @@ -17,3 +17,28 @@ jobs: uses: ./.github/workflows/build-storybook.yml with: artifact-name: "storybook-${{ github.head_ref }}" + publish-package: + needs: build + permissions: + packages: write + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v4 + - name: Setup node + uses: actions/setup-node@v4 + with: + # TODO: add version to a .nvmrc or at least a variable + node-version: 18.12.1 + cache: npm + registry-url: 'https://npm.pkg.github.com' + - name: Install + run: npm ci --omit=dev --prefer-offline + - name: Download dist + uses: actions/download-artifact@v4 + with: + name: "lib-${{ github.head_ref }}" + path: "./dist" + - run: npm publish + env: + NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/.npmignore b/.npmignore new file mode 100644 index 0000000..cea99ea --- /dev/null +++ b/.npmignore @@ -0,0 +1,34 @@ +# Logs +logs +*.log +npm-debug.log* +yarn-debug.log* +yarn-error.log* +pnpm-debug.log* +lerna-debug.log* + +node_modules +.DS_Store +dist-ssr +coverage +*.local + +/cypress/videos/ +/cypress/screenshots/ + +# Editor directories and files +.vscode/* +!.vscode/extensions.json +.idea +*.suo +*.ntvs* +*.njsproj +*.sln +*.sw? + +*.tsbuildinfo + +*storybook.log +storybook-static + +.npmrc diff --git a/package.json b/package.json index 07a39c2..de724e8 100644 --- a/package.json +++ b/package.json @@ -9,6 +9,10 @@ "require": "./dist/dsocto.cjs" } }, + "publishConfig": { + "registry": "https://npm.pkg.github.com" + }, + "repository": "https://github.com/octo-technology/Design-System---Marque-Blanche.git", "type": "module", "scripts": { "build": "vite build",