Merge pull request #50 from TomPlum/renovate/all-minor-patch #37
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: Demo Website | |
| on: | |
| push: | |
| branches: | |
| - main | |
| jobs: | |
| build-and-deploy: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: 18 | |
| cache: 'npm' | |
| - name: Install dependencies | |
| run: npm install | |
| - name: Build Library | |
| run: npm run build --workspace=@tomplum/react-git-log | |
| - name: Run Unit Tests | |
| env: | |
| TZ: UTC | |
| run: npm run test:unit:ci --workspace=@tomplum/react-git-log | |
| - name: Run Integration Tests | |
| env: | |
| TZ: UTC | |
| run: npm run test:integration:ci --workspace=@tomplum/react-git-log | |
| - name: Build Storybook | |
| run: npm run build-storybook --workspace=@tomplum/react-git-log-demo | |
| - name: Deploy to GitHub Pages | |
| uses: JamesIves/github-pages-deploy-action@v4 | |
| with: | |
| folder: ./packages/demo/storybook-static | |
| - name: Authenticate with NPM | |
| run: echo "//registry.npmjs.org/:_authToken=${NPM_TOKEN}" > ~/.npmrc | |
| env: | |
| NPM_TOKEN: ${{ secrets.NPM_TOKEN }} | |
| - name: Get package version | |
| id: package_version | |
| run: echo "VERSION=$(jq -r .version packages/library/package.json)" >> $GITHUB_ENV | |
| - name: Check if version exists on NPM | |
| id: check_version | |
| run: | | |
| if npm show @tomplum/react-git-log@${VERSION} > /dev/null 2>&1; then | |
| echo "VERSION_EXISTS=true" >> $GITHUB_ENV | |
| else | |
| echo "VERSION_EXISTS=false" >> $GITHUB_ENV | |
| fi | |
| - name: Publish to NPM | |
| if: env.VERSION_EXISTS == 'false' | |
| run: npm publish --workspace=@tomplum/react-git-log --access public | |
| env: | |
| NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} |