chore(ci): release main #937
Workflow file for this run
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: CI | |
on: | |
push: | |
branches: | |
- main | |
pull_request: | |
branches: | |
- main | |
workflow_dispatch: | |
inputs: | |
environment: | |
description: "Select deployment environment" | |
required: true | |
type: choice | |
options: | |
- prod | |
- dev | |
default: dev | |
permissions: | |
contents: write | |
pull-requests: write | |
repository-projects: write | |
concurrency: | |
group: ci-${{ github.ref }} | |
cancel-in-progress: true | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
permissions: | |
id-token: write | |
contents: read | |
environment: ${{ github.event.inputs.environment || 'dev' }} | |
env: | |
environment: ${{ github.event.inputs.environment || 'dev' }} | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
token: ${{ secrets.REPO_PAT }} | |
- name: Use Node.js | |
uses: actions/setup-node@v4 | |
with: | |
node-version: 20 | |
- name: Configure git | |
run: | | |
git config user.name "${GITHUB_ACTOR}" | |
git config user.email "${GITHUB_ACTOR}@users.noreply.github.com" | |
- name: Build and test | |
run: | | |
corepack enable | |
pnpm install --frozen-lockfile --ignore-scripts | |
pnpm nx affected --base=last-release -t format:check --parallel=3 | |
pnpm nx affected --base=last-release -t build --parallel=3 | |
pnpm nx affected --base=last-release -t lint --parallel=3 | |
pnpm nx affected --base=last-release -t test --parallel=3 | |
- name: Create Figma tokens flat artifact | |
uses: actions/upload-artifact@v4 | |
with: | |
name: figma-tokens | |
path: packages/design/figma/dist/tokens | |
- name: Create Figma tokens flat artifact | |
uses: actions/upload-artifact@v4 | |
with: | |
name: figma-tokens-flat | |
path: packages/design/figma/dist/tokens-flat | |
- name: Publish new version on NPM | |
if: github.ref == 'refs/heads/main' && env.environment == 'prod' | |
run: | | |
pnpm nx affected --base=last-release -t npm-publish --parallel=1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.REPO_PAT }} | |
NPM_TOKEN: ${{ secrets.NPM_TOKEN }} | |
- name: Tag Last Release | |
if: github.ref == 'refs/heads/main' && env.environment == 'prod' | |
shell: bash | |
run: | | |
git tag -f last-release | |
git push origin last-release --force | |
git checkout latest-release | |
git rebase origin/main | |
git push origin --force |