From ce74fed04626ea319339e0c77352127719a6770e Mon Sep 17 00:00:00 2001 From: aimee rivers Date: Mon, 27 Nov 2023 16:08:02 +0100 Subject: [PATCH] feat(workflows): add a shared publish-please workflow --- .github/workflows/publish-please.yml | 49 ++++++++++++++++++++++++++++ 1 file changed, 49 insertions(+) create mode 100644 .github/workflows/publish-please.yml diff --git a/.github/workflows/publish-please.yml b/.github/workflows/publish-please.yml new file mode 100644 index 0000000..4181772 --- /dev/null +++ b/.github/workflows/publish-please.yml @@ -0,0 +1,49 @@ +name: Publish Please + +on: + workflow_call: + inputs: + github_ref: + description: The git ref to publish + type: string + required: true + secrets: + READONLY_NPM_TOKEN: + description: Needed to install private @hedia npm packages + required: true + PUBLISHING_NPM_TOKEN: + description: Needed to publish @hedia npm packages + required: true + +jobs: + publish-please: + runs-on: ubuntu-latest + timeout-minutes: 10 + + steps: + - name: Checkout Repository + uses: actions/checkout@v3 + with: + ref: ${{ inputs.github_ref }} + fetch-depth: 1 + + - name: Setup Node.js Environment + uses: actions/setup-node@v3 + with: + node-version-file: "package.json" + always-auth: true + registry-url: https://registry.npmjs.org + scope: "@hedia" + + - name: Install Dependencies + run: npm ci + env: + NODE_AUTH_TOKEN: ${{ secrets.READONLY_NPM_TOKEN }} + + - name: Build + run: npm run build --if-present + + - name: Publish to npm + run: npm publish + env: + NODE_AUTH_TOKEN: ${{ secrets.PUBLISHING_NPM_TOKEN }}