From 38018a843240e44c5494c9a83833776696a3c220 Mon Sep 17 00:00:00 2001 From: Lexus Drumgold Date: Sat, 7 Jan 2023 21:43:47 -0500 Subject: [PATCH] ci(workflows): [`publish`] use node version file - https://github.com/actions/setup-node/blob/v3.5.1/action.yml#L10-L11 Signed-off-by: Lexus Drumgold --- .github/workflows/publish.yml | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 143fc502..dd77caf7 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -26,15 +26,13 @@ on: description: release tag required: true env: - ARTIFACT: + ARTIFACT: | ${{ github.event.inputs.artifact || github.event.release.assets[0].browser_download_url }} - NODE_VERSION: 16 SCOPE: ${{ format('@{0}', github.repository_owner) }} + TAG: ${{ github.event.inputs.tag || github.event.release.tag_name }} jobs: metadata: runs-on: ubuntu-latest - env: - TAG: ${{ github.event.inputs.tag || github.event.release.tag_name }} outputs: dist-tag: ${{ steps.dist-tag.outputs.flag }} version: ${{ steps.version.outputs.result }} @@ -66,12 +64,17 @@ jobs: ${{ format('{0}/{1}/pkgs/npm/{2}', github.server_url, github.repository, github.event.repository.name) }} steps: + - id: checkout + name: Checkout ${{ env.TAG }} + uses: actions/checkout@v3.2.0 + with: + ref: ${{ format('refs/tags/{0}', env.TAG) }} - id: npmrc name: Setup .npmrc file uses: actions/setup-node@v3.6.0 with: always-auth: true - node-version: ${{ env.NODE_VERSION }} + node-version-file: .nvmrc registry-url: https://npm.pkg.github.com scope: ${{ env.SCOPE }} - id: publish @@ -88,12 +91,17 @@ jobs: ${{ format('https://npmjs.com/package/@{0}/v/{1}', github.repository, needs.metadata.outputs.version) }} steps: + - id: checkout + name: Checkout ${{ env.TAG }} + uses: actions/checkout@v3.2.0 + with: + ref: ${{ format('refs/tags/{0}', env.TAG) }} - id: npmrc name: Setup .npmrc file uses: actions/setup-node@v3.6.0 with: always-auth: true - node-version: ${{ env.NODE_VERSION }} + node-version-file: .nvmrc registry-url: https://registry.npmjs.org scope: ${{ env.SCOPE }} - id: publish