From 8759389953136765ec288b9b5e1aac1e1613d7b6 Mon Sep 17 00:00:00 2001 From: Carlos Tribiec Date: Fri, 2 Feb 2024 11:14:31 -0400 Subject: [PATCH 1/3] chore: remove publish step from build.yml file --- .github/workflows/build.yml | 28 ---------------------------- 1 file changed, 28 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 6676a53..fe358d5 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -49,31 +49,3 @@ jobs: with: args: > -Dsonar.branch.name=${{ env.GITHUB_REF_NAME }} - build-and-publish: - if: github.ref == 'refs/heads/master' && startsWith(github.ref, 'refs/tags/') - runs-on: ubuntu-latest - strategy: - matrix: - node-version: ['18.x'] - steps: - - uses: actions/checkout@v2 - - name: Use Node.js ${{ matrix.node-version }} - uses: actions/setup-node@v1 - with: - node-version: ${{ matrix.node-version }} - registry-url: 'https://registry.npmjs.org' - - name: Cache node modules - uses: actions/cache@v2 - with: - path: node_modules - key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }} - restore-keys: | - ${{ runner.os }}-node- - - name: Install dependencies - run: npm install - - name: Build - run: npm run build - - name: npm publish - run: npm publish - env: - NODE_AUTH_TOKEN: ${{ secrets.NPM_AUTH_TOKEN }} From 33ee773ad21e80bb37c7cb4a7fc30a3279c018b3 Mon Sep 17 00:00:00 2001 From: Carlos Tribiec Date: Fri, 2 Feb 2024 11:15:04 -0400 Subject: [PATCH 2/3] chore: separate publish step to npm_package file --- .github/workflows/npm_package.yml | 40 +++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) create mode 100644 .github/workflows/npm_package.yml diff --git a/.github/workflows/npm_package.yml b/.github/workflows/npm_package.yml new file mode 100644 index 0000000..befae4b --- /dev/null +++ b/.github/workflows/npm_package.yml @@ -0,0 +1,40 @@ +name: NPM Package Release + +on: + push: + tags: + - '*' + +jobs: + publish: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - name: Use Node.js + uses: actions/setup-node@v1 + with: + node-version: '18.x' + registry-url: 'https://registry.npmjs.org' + - name: Cache node modules + uses: actions/cache@v2 + with: + path: node_modules + key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }} + restore-keys: | + ${{ runner.os }}-node- + - name: Install dependencies + run: npm install + - name: Verify if tag is in master branch + run: | + TAG_COMMIT=$(git rev-list -n 1 ${{ github.ref }}) + MASTER_COMMIT=$(git rev-list -n 1 master) + if ! git merge-base --is-ancestor $TAG_COMMIT $MASTER_COMMIT; then + echo "Tag is not in master branch." + exit 1 + fi + - name: Build (if needed for publication) + run: npm run build + - name: npm publish + run: npm publish + env: + NODE_AUTH_TOKEN: ${{ secrets.NPM_AUTH_TOKEN }} From 7760564a48566a792621fc62bf4ff99c0d52677b Mon Sep 17 00:00:00 2001 From: Carlos Tribiec Date: Fri, 2 Feb 2024 11:19:32 -0400 Subject: [PATCH 3/3] chore: remove step to verify if tag is created on master branch --- .github/workflows/npm_package.yml | 8 -------- 1 file changed, 8 deletions(-) diff --git a/.github/workflows/npm_package.yml b/.github/workflows/npm_package.yml index befae4b..7fa2301 100644 --- a/.github/workflows/npm_package.yml +++ b/.github/workflows/npm_package.yml @@ -24,14 +24,6 @@ jobs: ${{ runner.os }}-node- - name: Install dependencies run: npm install - - name: Verify if tag is in master branch - run: | - TAG_COMMIT=$(git rev-list -n 1 ${{ github.ref }}) - MASTER_COMMIT=$(git rev-list -n 1 master) - if ! git merge-base --is-ancestor $TAG_COMMIT $MASTER_COMMIT; then - echo "Tag is not in master branch." - exit 1 - fi - name: Build (if needed for publication) run: npm run build - name: npm publish