From 1b160cd7983c3e176a5b30ad4420d0aa63867b19 Mon Sep 17 00:00:00 2001 From: Christoph Knittel Date: Sun, 16 Jun 2024 12:24:35 +0200 Subject: [PATCH] Auto-publish tag builds to npm --- .github/workflows/ci.yml | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 6549850..79316e5 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -88,3 +88,31 @@ jobs: run: | npm i -g ${{ needs.build.outputs.artifact_filename }} npx create-rescript-app + + publish: + needs: [build, test] + + if: startsWith(github.ref, 'refs/tags/v') + + runs-on: ubuntu-latest + + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Use Node.js + uses: actions/setup-node@v4 + with: + node-version: 18 + registry-url: https://registry.npmjs.org # Needed to make auth work for publishing + + - name: Download artifacts + uses: actions/download-artifact@v4 + with: + name: ${{ needs.build.outputs.artifact_filename }} + + - name: Publish packages on npm with tag "ci" + env: + NODE_AUTH_TOKEN: ${{ secrets.NPM_ACCESS_TOKEN }} + run: | + npm publish ${{ needs.build.outputs.artifact_filename }} --tag ci