From 3c2d14f9f5d3bbd20b117ed8d8d10dc2269c2bac Mon Sep 17 00:00:00 2001 From: macdonst Date: Thu, 4 Jul 2024 14:19:32 -0400 Subject: [PATCH] Add CI workflow Signed-off-by: macdonst --- .github/workflows/ci.yml | 61 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 61 insertions(+) create mode 100644 .github/workflows/ci.yml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..b737547 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,61 @@ +name: Node CI + +# Push tests commits; pull_request tests PR merges +on: [ push, pull_request ] + +defaults: + run: + shell: bash + +jobs: + + test: + # Setup + runs-on: ubuntu-latest + # Go + steps: + - name: Check out repo + uses: actions/checkout@v4 + + - name: Set up Node.js + uses: actions/setup-node@v4 + with: + registry-url: https://registry.npmjs.org/ + + - name: Install + run: npm ci + + # ----- Only git tag testing + package publishing beyond this point ----- # + + # Publish to package registries + publish: + # Setup + if: startsWith(github.ref, 'refs/tags/v') + runs-on: ubuntu-latest + + # Go + steps: + - name: Check out repo + uses: actions/checkout@v4 + + - name: Set up Node.js + uses: actions/setup-node@v4 + with: + registry-url: https://registry.npmjs.org/ + + - name: Install + run: npm ci + + # Publish to npm + - name: Publish @RC to npm + if: contains(github.ref, 'RC') + run: npm publish --tag RC --access public + env: + NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} + + - name: Publish @latest to npm + if: contains(github.ref, 'RC') == false #'!contains()'' doesn't work lol + run: npm publish --access public + env: + NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} +