Move logging and error modules to their own directories (#3) #3
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: Version and release | |
| on: | |
| push: | |
| branches: | |
| - main | |
| permissions: | |
| contents: write | |
| pull-requests: write | |
| concurrency: ${{ github.workflow }}-${{ github.ref }} | |
| env: | |
| CI: true | |
| NODE_VERSION: 20 | |
| jobs: | |
| setup: | |
| name: 🏗️ Scaffold env | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: 🏃♂️ Checkout Repo | |
| uses: actions/checkout@v4 | |
| - name: 🔨 Setup pnpm | |
| uses: pnpm/action-setup@v4 | |
| with: | |
| run_install: false | |
| - name: 🧨 Setup Node ${{ env.NODE_VERSION }} | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: ${{ env.NODE_VERSION }} | |
| cache: 'pnpm' | |
| - name: 💾 Cache dependencies | |
| uses: actions/cache@v4 | |
| id: cache | |
| with: | |
| path: | | |
| ~/.pnpm-store | |
| ./node_modules | |
| key: pnpm-${{ runner.os }}-${{ hashFiles('pnpm-lock.yaml') }} | |
| restore-keys: | | |
| pnpm-${{ runner.os }}- | |
| - name: 💥 Install deps | |
| if: steps.cache.outputs.cache-hit != 'true' | |
| run: pnpm install | |
| # todo: It would be nice to abstract these so they arent duplicated | |
| lint: | |
| name: Lint 🔎 | |
| runs-on: ubuntu-latest | |
| needs: setup | |
| steps: | |
| - name: 🏃♂️ Checkout Repo | |
| uses: actions/checkout@v4 | |
| - name: 🔨 Setup pnpm | |
| uses: pnpm/action-setup@v4 | |
| with: | |
| run_install: false | |
| - name: 🧨 Setup Node ${{ env.NODE_VERSION }} | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: ${{ env.NODE_VERSION }} | |
| cache: 'pnpm' | |
| - name: 💾 Cache dependencies | |
| uses: actions/cache@v4 | |
| id: cache | |
| with: | |
| path: | | |
| ~/.pnpm-store | |
| ./node_modules | |
| key: pnpm-${{ runner.os }}-${{ hashFiles('pnpm-lock.yaml') }} | |
| restore-keys: | | |
| pnpm-${{ runner.os }}- | |
| - name: 💥 Init pnpm dependencies | |
| if: steps.cache.outputs.cache-hit != 'true' | |
| run: pnpm install | |
| - name: 🔎 Lint codebase | |
| run: pnpm lint | |
| test: | |
| name: Test 🧪 | |
| runs-on: ubuntu-latest | |
| needs: setup | |
| steps: | |
| - name: 🏃♂️ Checkout Repo | |
| uses: actions/checkout@v4 | |
| - name: 🔨 Setup pnpm | |
| uses: pnpm/action-setup@v4 | |
| with: | |
| run_install: false | |
| - name: 🧨 Setup Node ${{ env.NODE_VERSION }} | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: ${{ env.NODE_VERSION }} | |
| cache: 'pnpm' | |
| - name: 💾 Cache dependencies | |
| uses: actions/cache@v4 | |
| id: cache | |
| with: | |
| path: | | |
| ~/.pnpm-store | |
| ./node_modules | |
| key: pnpm-${{ runner.os }}-${{ hashFiles('pnpm-lock.yaml') }} | |
| restore-keys: | | |
| pnpm-${{ runner.os }}- | |
| - name: 💥 Init pnpm dependencies | |
| if: steps.cache.outputs.cache-hit != 'true' | |
| run: pnpm install | |
| - name: 🧪 Test codebase | |
| run: pnpm test | |
| compile: | |
| name: Compile ⚒️ | |
| runs-on: ubuntu-latest | |
| needs: setup | |
| steps: | |
| - name: 🏃♂️ Checkout Repo | |
| uses: actions/checkout@v4 | |
| - name: 🔨 Setup pnpm | |
| uses: pnpm/action-setup@v4 | |
| with: | |
| run_install: false | |
| - name: 🧨 Setup Node ${{ env.NODE_VERSION }} | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: ${{ env.NODE_VERSION }} | |
| cache: 'pnpm' | |
| - name: 💾 Cache dependencies | |
| uses: actions/cache@v4 | |
| id: cache | |
| with: | |
| path: | | |
| ~/.pnpm-store | |
| ./node_modules | |
| key: pnpm-${{ runner.os }}-${{ hashFiles('pnpm-lock.yaml') }} | |
| restore-keys: | | |
| pnpm-${{ runner.os }}- | |
| - name: 💥 Init pnpm dependencies | |
| if: steps.cache.outputs.cache-hit != 'true' | |
| run: pnpm install | |
| - name: ⚒️ Compile | |
| run: pnpm build | |
| release: | |
| name: Release @bengsfort/stdlib 🚀 | |
| runs-on: ubuntu-latest | |
| needs: [setup, lint, test, compile] | |
| steps: | |
| - name: 🏃♂️ Checkout Repo | |
| uses: actions/checkout@v4 | |
| - name: 🔨 Setup pnpm | |
| uses: pnpm/action-setup@v4 | |
| with: | |
| run_install: false | |
| - name: 🧨 Setup Node ${{ env.NODE_VERSION }} | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: ${{ env.NODE_VERSION }} | |
| cache: 'pnpm' | |
| - name: 💾 Cache dependencies | |
| uses: actions/cache@v4 | |
| id: cache | |
| with: | |
| path: | | |
| ~/.pnpm-store | |
| ./node_modules | |
| key: pnpm-${{ runner.os }}-${{ hashFiles('pnpm-lock.yaml') }} | |
| restore-keys: | | |
| pnpm-${{ runner.os }}- | |
| - name: 💥 Init pnpm dependencies | |
| if: steps.cache.outputs.cache-hit != 'true' | |
| run: pnpm install | |
| # Note: This runs the prepublishOnly, which is gonna duplicate the compile | |
| # step. Should try to figure out a way to avoid this, but it is what it is | |
| - name: 🚀 Create and publish new version | |
| uses: changesets/action@v1 | |
| with: | |
| version: pnpm changes:commit | |
| commit: "chore: Update package version" | |
| title: "chore: Update package version" | |
| publish: pnpm ci:publish | |
| createGithubReleases: true | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| NPM_TOKEN: ${{ secrets.NPM_TOKEN }} | |