From fea6369db532f3d959fda83a66d787f58f70b414 Mon Sep 17 00:00:00 2001 From: Johnathan MEUNIER Date: Thu, 21 Nov 2024 16:30:19 +0100 Subject: [PATCH] build(github-action): init the github action to publish on npm --- .github/workflows/publish.yml | 37 +++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) create mode 100644 .github/workflows/publish.yml diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml new file mode 100644 index 0000000..0d7d93e --- /dev/null +++ b/.github/workflows/publish.yml @@ -0,0 +1,37 @@ +name: Publish on npm registry + +on: + push: + branches: + - main + +jobs: + build: + if: github.repository_owner == 'AxaFrance' + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + with: + fetch-depth: 0 + - name: Use Node.js + uses: actions/setup-node@v4 + with: + node-version: "*" # Use the LTS Node.js version + cache: "npm" + registry-url: "https://registry.npmjs.org" + - name: Install GitVersion + uses: gittools/actions/gitversion/setup@v0 + with: + versionSpec: "5.x" + - name: Determine Version + id: gitversion + uses: gittools/actions/gitversion/execute@v0 + - run: npm ci + - run: npm run build + - run: | + git config --global user.email "jonathan.meunier@axa.fr" + git config --global user.name "Johnathan MEUNIER" + - run: npm version "${{ steps.gitversion.outputs.fullSemVer }}" + - run: npm publish --access public + env: + NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}