From a8671b36d9f419fa7e14b269fb9c90e86c8be5a7 Mon Sep 17 00:00:00 2001 From: "Gabriel R. Antunes" Date: Thu, 31 Oct 2024 18:11:14 -0400 Subject: [PATCH] chore(publish/npm): accept tag --- .github/actions/publish/npm/action.yml | 6 +++++- .github/workflows/release.yml | 15 +++++++++++++++ 2 files changed, 20 insertions(+), 1 deletion(-) diff --git a/.github/actions/publish/npm/action.yml b/.github/actions/publish/npm/action.yml index 0168b925..bb97b0f7 100644 --- a/.github/actions/publish/npm/action.yml +++ b/.github/actions/publish/npm/action.yml @@ -5,6 +5,10 @@ inputs: npm-token: required: true description: "NPM API Token for publish packages." + tag: + required: true + description: "Publish tag." + default: latest runs: using: "composite" @@ -31,4 +35,4 @@ runs: - name: Publish shell: bash - run: pnpm publish -r --no-git-checks + run: pnpm publish -r --no-git-checks --tag ${{ inputs.tag }} diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index ae071b8b..546fcb5d 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -95,9 +95,24 @@ jobs: - name: Checkout code uses: actions/checkout@v4 + - name: Extract tag + id: extract-tag + run: | + TAG=latest + FILE=.changeset/pre.json + + if [ -f ${FILE} ]; then + TAG=$(cat ${FILE} | jq .tag); + fi + + echo tag: ${TAG} + + echo "TAG=${TAG}" >> $GITHUB_OUTPUT + - name: Publish to the NPM registry uses: ./.github/actions/publish/npm with: + tag: "${{ steps.extract-tag.outputs.tag }}" npm-token: "${{ secrets.NPM_TOKEN }}" edge-publish-npm: