feat: add gittai package #7
This file contains hidden or 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: | |
| permissions: | |
| actions: read | |
| contents: write | |
| packages: write | |
| id-token: write | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.ref }} | |
| cancel-in-progress: ${{ github.event_name == 'pull_request' }} | |
| env: | |
| NX_VERBOSE_LOGGING: true | |
| jobs: | |
| build: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| ref: ${{ github.head_ref }} | |
| - name: Setup git | |
| id: git | |
| uses: ./.github/actions/setup-git | |
| # This enables task distribution via Nx Cloud | |
| # Run this command as early as possible, before dependencies are installed | |
| # Learn more at https://nx.dev/ci/reference/nx-cloud-cli#npx-nxcloud-startcirun | |
| # Uncomment this line to enable task distribution | |
| # - run: npx nx-cloud start-ci-run --distribute-on="3 linux-medium-js" --stop-agents-after="build" | |
| - name: Setup node, install dependencies and configure nx | |
| uses: ./.github/actions/nx-setup-node | |
| - name: Lint package configurations | |
| run: npx nx syncpack | |
| # Prepend any command with "nx-cloud record --" to record its logs to Nx Cloud | |
| # - run: npx nx-cloud record -- echo Hello World | |
| # Nx Affected runs only tasks affected by the changes in this PR/commit. Learn more: https://nx.dev/ci/features/affected | |
| - name: Build lint test affected projects | |
| run: npx nx affected --targets lint test build e2e | |
| - name: Version | |
| run: | | |
| if [ "${{ steps.git.outputs.branch-name }}" == "main" ]; then | |
| npx nx release \ | |
| --group packages \ | |
| --skip-publish | |
| else | |
| npx nx release \ | |
| --preid pr-${{ steps.git.outputs.commit-sha-short }} \ | |
| --group packages \ | |
| --skip-publish | |
| fi | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Authenticate GCP | |
| uses: './.github/actions/authenticate-gcp' | |
| - name: Publish | |
| run: | | |
| if [ "${{ steps.git.outputs.branch-name }}" == "main" ]; then | |
| npx nx release publish \ | |
| --group packages \ | |
| --tag latest | |
| else | |
| npx nx release publish \ | |
| --group packages \ | |
| --tag pr-${{ steps.git.outputs.commit-sha-short }} | |
| fi | |
| git push --follow-tags | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |