Production Release #146
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Production Release | |
on: | |
workflow_dispatch: | |
inputs: | |
force: | |
description: Force publish all packages? | |
type: boolean | |
default: false | |
graduate: | |
description: Graduate prerelease packages? | |
type: boolean | |
default: false | |
run-test: | |
description: Run unit test? | |
type: boolean | |
default: true | |
jobs: | |
build: | |
name: Build | |
runs-on: ubuntu-latest | |
steps: | |
- name: Check out repository code | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Setup resources and environment | |
uses: ./.github/actions/setup | |
id: setup | |
- name: Install Dependencies | |
run: npm ci --audit=false --fund=false | |
- name: Versions | |
run: | | |
node -v | |
npm -v | |
- name: Build | |
# Prevent NX caching it should always build | |
run: npm run build -- --skip-nx-cache | |
test: | |
name: ${{ format('{0}{1}', !inputs.run-test && 'Skip ' || '', 'Test / All Browsers') }} | |
needs: build | |
uses: ./.github/workflows/test_all_browsers.yml | |
secrets: inherit | |
with: | |
build-prefix: 'Production Release ' | |
skip: ${{ !inputs.run-test }} | |
publish: | |
name: Publish | |
needs: test | |
environment: | |
name: production | |
url: https://ui.refinitiv.com | |
runs-on: ubuntu-latest | |
steps: | |
- name: Check out repository code | |
uses: actions/checkout@v4 | |
with: | |
# Number of commits to fetch. 0 indicates all history for all branches and tags. | |
# Pulls all commits (needed for Lerna) | |
fetch-depth: 0 | |
token: ${{ secrets.GH_TOKEN }} | |
- name: Configure Git User | |
run: | | |
git config --global user.email "[email protected]" | |
git config --global user.name "refinitiv-ui-dev" | |
- name: Create Git Tag for the change detection | |
run: git tag release-base -f | |
- name: Gather resources and build | |
uses: ./.github/actions/checkout-install-and-build | |
- name: Setup command line option | |
shell: bash | |
run: | | |
[[ "${{ inputs.force }}" == "true" ]] && export FORCE=--force-publish || export FORCE='' | |
[[ "${{ inputs.graduate }}" == "true" ]] && export GRADUATE=--conventional-graduate || export GRADUATE='' | |
echo "FORCE_OPTION=$FORCE" >> $GITHUB_ENV | |
echo "GRADUATE_OPTION=$GRADUATE" >> $GITHUB_ENV | |
- name: Bump package versions and create GitHub release | |
run: npx lerna version --create-release github --conventional-commits ${{ env.FORCE_OPTION }} ${{ env.GRADUATE_OPTION }} --yes | |
env: | |
GH_TOKEN: ${{ secrets.GH_TOKEN }} | |
- name: Publish to NPM | |
run: npx lerna publish from-git --yes | |
env: | |
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} | |
- name: Deprecate Solar Theme on npm | |
run: npm deprecate @refinitiv-ui/solar-theme "Solar theme is deprecated. Consider migrating to @refinitiv-ui/halo-theme instead." | |
env: | |
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} | |
- name: Publish Docs | |
run: curl -X POST "https://api.cloudflare.com/client/v4/pages/webhooks/deploy_hooks/${{ secrets.CF_DEPLOY_HOOKS_ID_V7 }}" | |
- name: Publish Visual Studio Code Extension | |
run: | | |
npx nx reset # Workaround for the NX issue https://github.com/nrwl/nx/issues/17781 to prevent NX command below error. | |
echo package-lock.json >> .nxignore # Prevent this file affected for all packages, issue https://github.com/nrwl/nx/issues/15116 | |
npx nx affected --targets vsce:publish --base=release-base --head=HEAD | |
env: | |
VSCE_PAT: ${{ secrets.AZURE_DEVOPS_PAT }} |