From 7da6fbd152254935c8c351c958bddb3211feae76 Mon Sep 17 00:00:00 2001 From: Mario Buikhuizen Date: Tue, 27 Feb 2024 16:05:43 +0100 Subject: [PATCH] ci: run ci only once per push and add release-dry-run --- .github/workflows/unit.yml | 33 +++++++++++++++++++++++++++++---- 1 file changed, 29 insertions(+), 4 deletions(-) diff --git a/.github/workflows/unit.yml b/.github/workflows/unit.yml index f452799..62a5110 100644 --- a/.github/workflows/unit.yml +++ b/.github/workflows/unit.yml @@ -1,9 +1,11 @@ name: Build on: - - push - - pull_request - - workflow_dispatch + push: + branches: + - master + pull_request: + workflow_dispatch: jobs: code-quality: @@ -132,9 +134,32 @@ jobs: name: ipyvue-test-results path: test-results + release-dry-run: + needs: [ test,ui-test,code-quality ] + runs-on: ubuntu-20.04 + steps: + - uses: actions/download-artifact@v3 + with: + name: ipyvue-dist-${{ github.run_number }} + + - name: Install node + uses: actions/setup-node@v1 + with: + node-version: "14.x" + registry-url: "https://registry.npmjs.org" + + - name: Publish the NPM package + run: | + cd js + echo $PRE_RELEASE + if [[ $PRE_RELEASE == "true" ]]; then export TAG="next"; else export TAG="latest"; fi + npm publish --tag ${TAG} --access public *.tgz + env: + NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} + PRE_RELEASE: ${{ github.event.release.prerelease }} release: if: startsWith(github.event.ref, 'refs/tags/v') - needs: [test,ui-test,code-quality] + needs: [release-dry-run] runs-on: ubuntu-20.04 steps: - uses: actions/download-artifact@v3