diff --git a/.github/actions/install/action.yml b/.github/actions/install/action.yml new file mode 100644 index 0000000..6a5fb85 --- /dev/null +++ b/.github/actions/install/action.yml @@ -0,0 +1,23 @@ +name: Node setup and Install Dependencies + +inputs: + npm-token: + required: true + +runs: + using: "composite" + steps: + - name: Use Node.js + uses: actions/setup-node@v3 + with: + node-version: "20.x" + registry-url: "https://registry.npmjs.org" + always-auth: true + + - name: Setup npm authentication + run: echo "//registry.npmjs.org/:_authToken=${{ inputs.npm-token }}" > ~/.npmrc + shell: bash + + - name: Install dependencies + run: npm ci + shell: bash \ No newline at end of file diff --git a/.github/workflows/publish-beta-release.yml b/.github/workflows/publish-beta-release.yml index 7774f75..2e5929c 100644 --- a/.github/workflows/publish-beta-release.yml +++ b/.github/workflows/publish-beta-release.yml @@ -12,18 +12,10 @@ jobs: - name: Checkout code uses: actions/checkout@v3 - - name: Use Node.js - uses: actions/setup-node@v3 + - name: Setup Node, auth, and install deps + uses: ./.github/actions/install with: - node-version: "20.x" - registry-url: "https://registry.npmjs.org" - always-auth: true - - - name: Setup npm authentication - run: echo "//registry.npmjs.org/:_authToken=${{ secrets.NPM_CHAINLINK_LOCAL }}" > ~/.npmrc - - - name: Install dependencies - run: npm ci + npm-token: ${{ secrets.NPM_CHAINLINK_LOCAL }} - name: Publish run: npm publish --tag beta diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 7454244..c7b5b4d 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -12,18 +12,10 @@ jobs: - name: Checkout code uses: actions/checkout@v3 - - name: Use Node.js - uses: actions/setup-node@v3 + - name: Setup Node, auth, and install deps + uses: ./.github/actions/install with: - node-version: "20.x" - registry-url: "https://registry.npmjs.org" - always-auth: true - - - name: Setup npm authentication - run: echo "//registry.npmjs.org/:_authToken=${{ secrets.NPM_CHAINLINK_LOCAL }}" > ~/.npmrc - - - name: Install dependencies - run: npm ci + npm-token: ${{ secrets.NPM_CHAINLINK_LOCAL }} - name: Publish run: npm publish