diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index a6cb904..d7f1fe1 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -4,14 +4,16 @@ name: Publish on: workflow_dispatch: + workflow_call: + inputs: + branch: + description: The branch containing the release code snapshot + required: true + type: string + default: "" push: branches: - main - tags: - - 'v*.*.*' - release: - types: - - published permissions: contents: write @@ -19,7 +21,7 @@ permissions: jobs: publish-ea: - if: startsWith(github.ref, 'refs/tags/') == false + if: github.event_name == 'push' runs-on: ubuntu-latest name: Publish EA release to NPM steps: @@ -70,14 +72,14 @@ jobs: npm publish --verbose --tag ea --access public --provenance publish-release: - if: startsWith(github.ref, 'refs/tags/') + if: github.event_name == 'workflow_call' || github.event_name == 'workflow_dispatch' runs-on: ubuntu-latest name: Publish release to NPM steps: - name: Checkout sources uses: actions/checkout@v4 with: - ref: ${{ github.ref }} + ref: ${{ inputs.branch || github.ref }} fetch-depth: 0 - name: Install node 24 @@ -90,21 +92,6 @@ jobs: - name: Update npm run: npm install -g npm@latest - - name: Get tag name - id: tag - run: | - TAG_NAME=${GITHUB_REF#refs/tags/} - echo "name=$TAG_NAME" >> "$GITHUB_OUTPUT" - - - name: Update package.json with tag version - id: update-version - run: | - TAG_NAME="${{ steps.tag.outputs.name }}" - # Remove 'v' prefix if present - VERSION=${TAG_NAME#v} - npm version "$VERSION" --no-git-tag-version - echo "version=$VERSION" >> "$GITHUB_OUTPUT" - - name: Install project modules run: npm ci diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index bf65e44..57f69b6 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -111,3 +111,8 @@ jobs: env: GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} + - name: Run Publish pipeline + uses: ./.github/workflows/publish.yml + with: + branch: "release/v${{ steps.bump.outputs.version }}" +