Merge pull request #929 from Availity/feature/spaces-react-router-v7 #532
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: Publish Release | |
| on: | |
| push: | |
| branches: [main] | |
| jobs: | |
| setup: | |
| if: "${{!contains(github.event.head_commit.message, 'skip ci') && !contains(github.event.head_commit.message, 'Release: Version Updates')}}" | |
| runs-on: ubuntu-latest | |
| permissions: | |
| actions: read | |
| steps: | |
| - name: Checkout Code | |
| uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3 | |
| with: | |
| fetch-depth: 0 | |
| ref: 'main' | |
| - name: Derive appropriate SHAs for base and head for `nx affected` commands | |
| uses: nrwl/nx-set-shas@afb73a62d26e41464e9254689e1fd6122ee683c1 # v5.0.1 | |
| - name: Set Node Version | |
| uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6.4.0 | |
| with: | |
| node-version: 24 | |
| cache: 'yarn' | |
| cache-dependency-path: 'yarn.lock' | |
| - name: Install Dependencies | |
| run: yarn install --immutable | |
| - name: Restore Nx Cache | |
| uses: actions/cache@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5.0.5 | |
| with: | |
| path: .nx/cache | |
| key: nx-${{ runner.os }}-${{ hashFiles('yarn.lock') }}-${{ github.sha }} | |
| restore-keys: | | |
| nx-${{ runner.os }}-${{ hashFiles('yarn.lock') }}- | |
| - name: Build Packages | |
| run: yarn build | |
| - name: Lint Affected Code | |
| run: yarn lint:affected | |
| - name: Unit Test Affected Code | |
| run: yarn test:ci | |
| publish: | |
| if: "${{!contains(github.event.head_commit.message, 'skip ci') && !contains(github.event.head_commit.message, 'Release: Version Updates')}}" | |
| needs: [setup] | |
| runs-on: ubuntu-latest | |
| outputs: | |
| has_changes: ${{ steps.changes.outputs.has_changes }} | |
| permissions: | |
| contents: write | |
| pull-requests: write | |
| id-token: write | |
| steps: | |
| - name: Checkout Code | |
| uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3 | |
| with: | |
| token: ${{ secrets.GITHUB_TOKEN }} | |
| fetch-depth: 0 | |
| ref: 'main' | |
| - name: Derive appropriate SHAs for base and head for `nx affected` commands | |
| uses: nrwl/nx-set-shas@afb73a62d26e41464e9254689e1fd6122ee683c1 # v5.0.1 | |
| - name: Set Node Version | |
| uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6.4.0 | |
| with: | |
| node-version: 24 | |
| cache: 'yarn' | |
| cache-dependency-path: 'yarn.lock' | |
| - name: Install Dependencies | |
| run: yarn install --immutable | |
| - name: Restore Nx Cache | |
| uses: actions/cache@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5.0.5 | |
| with: | |
| path: .nx/cache | |
| key: nx-${{ runner.os }}-${{ hashFiles('yarn.lock') }}-${{ github.sha }} | |
| restore-keys: | | |
| nx-${{ runner.os }}-${{ hashFiles('yarn.lock') }}- | |
| - name: Build Packages | |
| run: yarn build | |
| - name: Setup Publish Config | |
| run: | | |
| git config user.email ${{ secrets.GH_EMAIL }} | |
| git config user.name ${{ secrets.GH_USER }} | |
| - name: Store initial commit SHA | |
| id: initial-sha | |
| run: echo "sha=$(git rev-parse HEAD)" >> $GITHUB_OUTPUT | |
| - name: Version Packages | |
| run: | | |
| yarn nx affected --target version --parallel=1 | |
| - name: Check for Version Changes | |
| id: changes | |
| run: | | |
| INITIAL_SHA="${{ steps.initial-sha.outputs.sha }}" | |
| CURRENT_SHA=$(git rev-parse HEAD) | |
| if [ "$INITIAL_SHA" = "$CURRENT_SHA" ]; then | |
| echo "has_changes=false" >> $GITHUB_OUTPUT | |
| echo "No new commits created by version step" | |
| else | |
| echo "has_changes=true" >> $GITHUB_OUTPUT | |
| echo "New commits created by version step" | |
| fi | |
| - name: Publish | |
| if: steps.changes.outputs.has_changes == 'true' | |
| run: | | |
| yarn nx affected --target publish --parallel=1 | |
| - name: Create Release PR | |
| if: steps.changes.outputs.has_changes == 'true' | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| run: | | |
| echo "Creating PR because changes detected: ${{ steps.changes.outputs.has_changes }}" | |
| git push origin --delete release/version-updates || true | |
| git checkout -b release/version-updates | |
| git push origin release/version-updates | |
| git push origin --tags | |
| gh pr create --title "Release: Version Updates" --body "Automated release PR with version updates and package publications." --base main --head release/version-updates | |
| deploy-docs: | |
| if: "${{!contains(github.event.head_commit.message, 'skip ci') && !contains(github.event.head_commit.message, 'Release: Version Updates')}}" | |
| needs: [setup] | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: write | |
| steps: | |
| - name: Checkout Code | |
| uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3 | |
| with: | |
| fetch-depth: 0 | |
| ref: ${{ github.sha }} | |
| - name: Set Node Version | |
| uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6.4.0 | |
| with: | |
| node-version: 24 | |
| cache: 'yarn' | |
| cache-dependency-path: 'yarn.lock' | |
| - name: Install Dependencies | |
| run: yarn install --immutable | |
| - name: Build Packages | |
| run: yarn build | |
| - name: Build Docs | |
| run: yarn build:storybook:ci | |
| - name: Deploy to GitHub Pages | |
| uses: peaceiris/actions-gh-pages@4f9cc6602d3f66b9c108549d475ec49e8ef4d45e # v4.0.0 | |
| with: | |
| github_token: ${{ secrets.GITHUB_TOKEN }} | |
| publish_dir: dist/storybook | |
| keep_files: true | |
| enable_jekyll: false |