refactor: Remove unused files and update dependencies in .github/asyn… #37
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"] | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.ref }} | |
cancel-in-progress: ${{ github.ref != 'refs/heads/main' }} | |
jobs: | |
check-changes: | |
runs-on: ubuntu-latest | |
outputs: | |
async-id-changed: ${{ steps.check.outputs.async-id-changed }} | |
ui-changed: ${{ steps.check.outputs.ui-changed }} | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Check for async-id changes | |
id: check | |
run: | | |
echo "Checking for changes in packages/async-id..." | |
if git diff --name-only HEAD^ HEAD | grep -q '^packages/async-id/'; then | |
echo "::set-output name=async-id-changed::true" | |
else | |
echo "::set-output name=async-id-changed::false" | |
fi | |
echo "Checking for changes in packages/ui..." | |
if git diff --name-only HEAD^ HEAD | grep -q '^packages/ui/'; then | |
echo "::set-output name=ui-changed::true" | |
else | |
echo "::set-output name=ui-changed::false" | |
fi | |
shell: bash | |
async-id-test: | |
name: Async-id (Lint, Build, Test, Deploy) | |
needs: check-changes | |
if: needs.check-changes.outputs.async-id-changed == 'true' | |
timeout-minutes: 5 | |
strategy: | |
fail-fast: false | |
matrix: | |
os: [ubuntu-latest] | |
node: [20] | |
runs-on: ${{ matrix.os }} | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Use pnpm | |
run: corepack enable pnpm && pnpm --version | |
- name: Use Node.js ${{ matrix.node }} | |
uses: actions/setup-node@v3 | |
with: | |
node-version: ${{ matrix.node }} | |
cache: "pnpm" | |
- run: pnpm install | |
- run: pnpm test | |
- name: Maybe Release | |
if: github.ref == 'refs/heads/main' | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
NPM_TOKEN: ${{ secrets.NPM_TOKEN_ELEVATED }} | |
run: pnpm dlx [email protected] | |
pol-ui: | |
name: 🧪 Pol-UI (Lint, Build, Test, Deploy) | |
needs: check-changes | |
if: needs.check-changes.outputs.ui-changed == 'true' | |
runs-on: ubuntu-latest | |
steps: | |
- name: 👍 Checkout | |
uses: actions/checkout@v3 | |
- name: 💡 Install PNPM | |
run: npm install -g pnpm | |
- name: ❇️ Setup node.js LTS | |
uses: actions/setup-node@v3 | |
with: | |
node-version: lts/* | |
cache: "pnpm" | |
- name: 📥 Install Dependencies | |
run: pnpm ui install | |
- name: 💅 Lint | |
run: pnpm ui lint | |
- name: 🧪 Unit Tests and coverage | |
run: pnpm ui test | |
- name: setup git config | |
run: | | |
git config user.name "Bot" | |
git config user.email "" | |
- name: Get run number | |
id: run_number | |
run: echo "RUN_NUMBER=${{ github.run_number }}" >> $GITHUB_ENV | |
- name: Update version in package.json | |
run: | | |
cd packages/ui | |
node -e " | |
let pkg = require('./package.json'); | |
let versionParts = pkg.version.split('.'); | |
versionParts[2] = '${{ env.RUN_NUMBER }}'; | |
pkg.version = versionParts.join('.'); | |
require('fs').writeFileSync('./package.json', JSON.stringify(pkg, null, 2)); | |
" | |
shell: bash | |
- name: 🍀 Publish to NPM | |
if: github.ref == 'refs/heads/main' | |
run: | | |
echo "//registry.npmjs.org/:_authToken=${NODE_AUTH_TOKEN}" > ~/.npmrc | |
cd packages/ui | |
pnpm publish --no-git-checks | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
NPM_TOKEN: ${{ secrets.NPM_TOKEN }} | |
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} |