From 57ef5d445ec8720cd582742036b1472031f48954 Mon Sep 17 00:00:00 2001 From: Mario Buikhuizen Date: Tue, 27 Feb 2024 16:16:53 +0100 Subject: [PATCH] ci: run ci only once per push and add release-dry-run --- .github/workflows/unit.yml | 35 +++++++++++++++++++++++++++++++---- 1 file changed, 31 insertions(+), 4 deletions(-) diff --git a/.github/workflows/unit.yml b/.github/workflows/unit.yml index f452799..a20c9fd 100644 --- a/.github/workflows/unit.yml +++ b/.github/workflows/unit.yml @@ -1,9 +1,13 @@ name: Build on: - - push - - pull_request - - workflow_dispatch + push: + branches: + - master + tags: + - v* + pull_request: + workflow_dispatch: jobs: code-quality: @@ -132,9 +136,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 --dry-run --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