diff --git a/.github/actions/publish-release/action.yml b/.github/actions/publish-release/action.yml deleted file mode 100644 index 83979bee..00000000 --- a/.github/actions/publish-release/action.yml +++ /dev/null @@ -1,54 +0,0 @@ -name: "Publish Release" -description: "Publishes a release to Github and npm" - -inputs: - branchName: - description: 'The branch name of from which this release was triggered' - required: false - default: 'latest' - githubToken: - description: 'The Github auth token' - required: false - default: 'latest' - npmToken: - description: 'The npm auth token' - required: false - default: 'latest' - -runs: - using: "composite" - steps: - - name: Checkout - uses: actions/checkout@v4 - with: - fetch-depth: 0 - - - name: Setup Project - uses: ./.github/actions/setup - - - name: Build Project - run: npm run build - shell: bash - - - name: Get Next Release Version - env: - GITHUB_TOKEN: ${{ inputs.githubToken }} - id: get_release_version - run: | - export NEXT_TAG_VERSION=$(npx semantic-release --dry-run | grep 'The next release version is' | sed -E 's/.* ([[:digit:].]+)$/\1/') - echo "new_tag_version=${NEXT_TAG_VERSION}" >> $GITHUB_OUTPUT - shell: bash - - - name: Semantic Release - env: - GITHUB_TOKEN: ${{ inputs.githubToken }} - if: ${{ steps.get_release_version.outputs.new_tag_version != '' }} - run: npx semantic-release - shell: bash - - - name: Publish to npm - env: - NODE_AUTH_TOKEN: ${{ inputs.npmToken }} - if: ${{ steps.get_release_version.outputs.new_tag_version != '' }} - run: npm publish ./dist/*.tgz --tag ${{ inputs.branchName == 'main' && 'latest' || inputs.branchName }} - shell: bash diff --git a/.github/workflows/handle-release-branch-push.yml b/.github/workflows/handle-release-branch-push.yml index 5767c949..88758c53 100644 --- a/.github/workflows/handle-release-branch-push.yml +++ b/.github/workflows/handle-release-branch-push.yml @@ -40,9 +40,32 @@ jobs: with: fetch-depth: 0 - - name: Publish release - uses: ./.github/actions/publish-release - with: - branchName: ${{ github.head_ref || github.ref_name }} - githubToken: ${{ secrets.GITHUB_TOKEN }} - npmToken: ${{ secrets.NPM_TOKEN }} + - name: Setup Project + uses: ./.github/actions/setup + + - name: Build Project + run: npm run build + shell: bash + + - name: Get Next Release Version + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + id: get_release_version + run: | + export NEXT_TAG_VERSION=$(npx semantic-release --dry-run | grep 'The next release version is' | sed -E 's/.* ([[:digit:].]+)$/\1/') + echo "new_tag_version=${NEXT_TAG_VERSION}" >> $GITHUB_OUTPUT + shell: bash + + - name: Semantic Release + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + if: ${{ steps.get_release_version.outputs.new_tag_version != '' }} + run: npx semantic-release + shell: bash + + - name: Publish to npm + env: + NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} + if: ${{ steps.get_release_version.outputs.new_tag_version != '' }} + run: npm publish ./dist/*.tgz --tag ${{ (github.head_ref || github.ref_name) == 'main' && 'latest' || github.head_ref || github.ref_name }} + shell: bash