Skip to content

Merge pull request #1475 from boostercloud/improved-github-issue-temp… #11

Merge pull request #1475 from boostercloud/improved-github-issue-temp…

Merge pull request #1475 from boostercloud/improved-github-issue-temp… #11

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:$GITHUB_PAT@github.com/boostercloud/booster.git"
git fetch
git config --local user.email "action@github.com"
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@v3
with:
node-version: 16.x
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 }}