From 017250836e444554f53fd4b33c975a09f5f84273 Mon Sep 17 00:00:00 2001 From: samcyn Date: Mon, 1 Apr 2024 18:24:43 +0100 Subject: [PATCH] ci(plugin): add github action --- .github/workflows/publish-npm.yml | 37 +++++++++++++++++++++++++++++++ .github/workflows/update-main.yml | 31 ++++++++++++++++++++++++++ 2 files changed, 68 insertions(+) create mode 100644 .github/workflows/publish-npm.yml create mode 100644 .github/workflows/update-main.yml diff --git a/.github/workflows/publish-npm.yml b/.github/workflows/publish-npm.yml new file mode 100644 index 0000000..e1ccdbd --- /dev/null +++ b/.github/workflows/publish-npm.yml @@ -0,0 +1,37 @@ +name: Publish to npm with Yarn + +on: + push: + branches: + - release + pull_request: + branches: + - release + +jobs: + publish: + runs-on: ubuntu-latest + + steps: + - name: Checkout code + uses: actions/checkout@v2 + + - name: Setup Node.js + uses: actions/setup-node@v3 + with: + node-version: 20.9.0 + + - name: Install Yarn + run: npm install -g yarn@3.3.1 + + - name: Install dependencies with Yarn + run: yarn install --frozen-lockfile + + - name: Run tests with Yarn + run: yarn test + + - name: Publish to npm with Yarn + if: github.event_name == 'push' && github.ref == 'refs/heads/release' + run: yarn publish --access public + env: + NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} diff --git a/.github/workflows/update-main.yml b/.github/workflows/update-main.yml new file mode 100644 index 0000000..0066c20 --- /dev/null +++ b/.github/workflows/update-main.yml @@ -0,0 +1,31 @@ +name: Publish to npm with Yarn + +on: + push: + branches: + - main + pull_request: + branches: + - main + +jobs: + publish: + runs-on: ubuntu-latest + + steps: + - name: Checkout code + uses: actions/checkout@v2 + + - name: Setup Node.js + uses: actions/setup-node@v3 + with: + node-version: 20.9.0 + + - name: Install Yarn + run: npm install -g yarn@3.3.1 + + - name: Install dependencies with Yarn + run: yarn install --frozen-lockfile + + - name: Run tests with Yarn + run: yarn test