Merge pull request #968 from Availity/fix/logs-undefined #265
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
| # This workflow will do a clean install of node dependencies, build the source code and run tests across different versions of node | |
| # For more information see: https://help.github.com/actions/language-and-framework-guides/using-nodejs-with-github-actions | |
| name: Publish Release | |
| on: | |
| push: | |
| branches: [master] | |
| 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@08eba0b27e820071cde6df949e0beb9ba4906955 # v4.3.0 | |
| with: | |
| fetch-depth: 0 | |
| ref: 'master' | |
| - name: Derive appropriate SHAs for base and head for `nx affected` commands | |
| uses: nrwl/nx-set-shas@826660b82addbef3abff5fa871492ebad618c9e1 # v4.3.3 | |
| with: | |
| main-branch-name: 'master' | |
| - name: Set Node Version | |
| uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0 | |
| with: | |
| node-version: 22 | |
| cache: 'yarn' | |
| cache-dependency-path: 'yarn.lock' | |
| # - name: Get yarn cache directory path | |
| # id: yarn-cache-dir-path | |
| # run: | | |
| # echo "dir=$(yarn config get cacheFolder)" >> $GITHUB_OUTPUT | |
| # - name: Restore yarn cache | |
| # uses: actions/cache@v3 | |
| # id: yarn-cache | |
| # with: | |
| # path: ${{ steps.yarn-cache-dir-path.outputs.dir }} | |
| # key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }} | |
| # restore-keys: | | |
| # ${{ runner.os }}-yarn- | |
| # - name: Artifactory Check | |
| # run: yarn check:registry | |
| - name: Install Dependencies | |
| run: yarn install --immutable | |
| - name: Lint Source Code | |
| run: yarn lint | |
| - name: Unit Tests | |
| run: yarn test:ci | |
| - name: Build Packages | |
| run: yarn build | |
| 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 # Required for git push and creating tags | |
| pull-requests: write # Required for creating pull requests | |
| id-token: write | |
| steps: | |
| - uses: actions/checkout@08eba0b27e820071cde6df949e0beb9ba4906955 # v4.3.0 | |
| with: | |
| fetch-depth: 0 | |
| ref: 'master' | |
| token: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Derive appropriate SHAs for base and head for `nx affected` commands | |
| uses: nrwl/nx-set-shas@826660b82addbef3abff5fa871492ebad618c9e1 # v4.3.3 | |
| with: | |
| main-branch-name: 'master' | |
| - name: Set Node Version | |
| uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0 | |
| with: | |
| node-version: 22 | |
| cache: 'yarn' | |
| cache-dependency-path: 'yarn.lock' | |
| - name: Install latest npm | |
| run: npm install -g npm@latest | |
| - name: Install Dependencies | |
| run: yarn install --immutable | |
| - 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 master --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: [publish] | |
| runs-on: ubuntu-latest | |
| permissions: | |
| pages: write | |
| id-token: write | |
| environment: | |
| name: github-pages | |
| url: ${{ steps.deployment.outputs.page_url }} | |
| steps: | |
| - uses: actions/checkout@08eba0b27e820071cde6df949e0beb9ba4906955 # v4.3.0 | |
| with: | |
| fetch-depth: 0 | |
| ref: 'master' | |
| - name: Set Node Version | |
| uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0 | |
| with: | |
| node-version: 22 | |
| cache: 'yarn' | |
| cache-dependency-path: 'yarn.lock' | |
| - name: Install Dependencies | |
| run: yarn install --immutable | |
| - name: Build Docs | |
| run: yarn build:docs | |
| - name: Upload Pages Artifact | |
| uses: actions/upload-pages-artifact@56afc609e74202658d3ffba0e8f6dda462b719fa # v3.0.1 | |
| with: | |
| path: docusaurus/build | |
| - name: Deploy to GitHub Pages | |
| id: deployment | |
| uses: actions/deploy-pages@d6db90164ac5ed86f2b6aed7e0febac5b3c0c03e # v4.0.5 |