Skip to content

Remove events (#1416) #88

Remove events (#1416)

Remove events (#1416) #88

name: Publish to npm
on:
push:
branches:
- 'main'
paths-ignore:
- '**.md'
- 'website/**'
- '.github/**'
- '.vscode/**'
- 'packages/**/.vscode/**'
jobs:
integration-tests:
if: "!contains(github.event.head_commit.author.name, 'GITHUBACTION')"
name: Ensuring integration tests pass before publishing
uses: ./.github/workflows/wf_test-integration.yml
secrets: inherit
publish-npm:
if: "!contains(github.event.head_commit.author.name, 'GITHUBACTION')"
name: Publish to npm
needs: integration-tests
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0 # required for Rush change
token: ${{ secrets.GITHUB_TOKEN_ACTION }}
# Workaround for https://github.com/actions/checkout/issues/6#issuecomment-520636057
- name: Prepare repository
run: git checkout "${GITHUB_REF:11}"
- name: Configure Git
run: |
git remote rm origin
git remote add origin "https://$USER_NAME:[email protected]/boostercloud/booster.git"
git fetch
git config --local user.email "[email protected]"
git config --local user.name "GITHUBACTION"
git config pull.rebase true
env:
USER_NAME: ${{ secrets.DEPLOYING_USER_NAME }}
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN_ACTION }} # Token for pushing
- uses: actions/setup-node@v4
with:
node-version: 18.18
registry-url: https://registry.npmjs.org/
- name: Rush Update
uses: ./.github/actions/call-rush
with:
command: update
- name: Rush Install
uses: ./.github/actions/call-rush
with:
command: install
- name: Rush Build
uses: ./.github/actions/call-rush
with:
command: build
# Discard all changes that might have occurred after change build
- run: git stash
- name: Authenticate with Registry
run: npm config set "//registry.npmjs.org/:_authToken" "$NPM_TOKEN"
env:
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
- name: Publish using Rush
uses: ./.github/actions/call-rush
with:
command: publish --apply --publish --target-branch main --add-commit-details
env:
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN_ACTION }}