diff --git a/.github/actions/setup-node-pnpm-install/action.yml b/.github/actions/setup-node-pnpm-install/action.yml new file mode 100644 index 0000000..78235c4 --- /dev/null +++ b/.github/actions/setup-node-pnpm-install/action.yml @@ -0,0 +1,16 @@ +# Taken from obytes' react native template: https://github.com/obytes/react-native-template-obytes + +name: "Setup Node + PNPM + Install Dependencies" +description: "Setup Node + PNPM + Install Dependencies" +runs: + using: "composite" + steps: + - uses: pnpm/action-setup@v4 + + - uses: actions/setup-node@v4 + with: + cache: "pnpm" + + - name: 📦 Install Project Dependencies + run: pnpm install --frozen-lockfile + shell: bash diff --git a/.github/dependabot.yml b/.github/dependabot.yml index 0c5a2cb..d757690 100644 --- a/.github/dependabot.yml +++ b/.github/dependabot.yml @@ -7,3 +7,7 @@ updates: commit-message: prefix: "build(deps)" versioning-strategy: increase + groups: + all: + patterns: + - "*" diff --git a/.github/workflows/precheck.yml b/.github/workflows/precheck.yml new file mode 100644 index 0000000..3d7429a --- /dev/null +++ b/.github/workflows/precheck.yml @@ -0,0 +1,77 @@ +# Taken from obytes' react native template: https://github.com/obytes/react-native-template-obytes + +name: Precheck + +on: + pull_request: + branches: [main] + workflow_call: + +jobs: + install: + name: Prepare enviroment + Cache + runs-on: ubuntu-latest + steps: + - name: 📦 Checkout project repo + uses: actions/checkout@v4 + with: + fetch-depth: 0 + + - name: 📦 Setup Node + PNPM + install deps + uses: ./.github/actions/setup-node-pnpm-install + + lint: + name: Lint TS (eslint, prettier) + needs: [install] + runs-on: ubuntu-latest + steps: + - name: 📦 Checkout project repo + uses: actions/checkout@v4 + with: + fetch-depth: 0 + + - name: 📦 Setup Node + PNPM + install deps + uses: ./.github/actions/setup-node-pnpm-install + + - name: 🏃‍♂️ Run ESLint PR + if: github.event_name == 'pull_request' + uses: reviewdog/action-eslint@v1 + with: + github_token: ${{ secrets.GITHUB_TOKEN }} + reporter: github-pr-review + eslint_flags: "src --max-warnings=0" + + - name: 🏃‍♂️ Run ESLint PR + if: github.event_name != 'pull_request' + run: pnpm run lint + + type-check: + name: Check + needs: [install] + runs-on: ubuntu-latest + steps: + - name: 📦 Checkout project repo + uses: actions/checkout@v4 + with: + fetch-depth: 0 + + - name: 📦 Setup Node + PNPM + install deps + uses: ./.github/actions/setup-node-pnpm-install + + - name: 📦 Install Reviewdog + if: github.event_name == 'pull_request' + uses: reviewdog/action-setup@v1 + + - name: 🏃‍♂️ Run TypeScript PR # Reviewdog tsc errorformat: %f:%l:%c - error TS%n: %m + # We only need to add the reviewdog step if it's a pull request + if: github.event_name == 'pull_request' + run: | + pnpm check | reviewdog -name="tsc" -efm="%f(%l,%c): error TS%n: %m" -reporter="github-pr-review" -filter-mode="nofilter" -fail-on-error -tee + env: + REVIEWDOG_GITHUB_API_TOKEN: ${{ secrets.GITHUB_TOKEN }} + + - name: + 🏃‍♂️ Run TypeScript Commit + # If it's not a Pull Request then we just need to run the type-check + if: github.event_name != 'pull_request' + run: pnpm check diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..c218571 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,28 @@ +on: + push: + branches: + - main + +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: ${{ github.ref != 'refs/heads/main' }} + +name: "release" + +jobs: + prepare: + uses: ./.github/workflows/precheck.yml + + release: + runs-on: ubuntu-latest + needs: [prepare] + permissions: + contents: write + pull-requests: write + steps: + - uses: googleapis/release-please-action@v4 + id: release + with: + release-type: node + outputs: + release-created: ${{ steps.release.outputs.release_created }} diff --git a/package.json b/package.json index de3bb49..8211644 100644 --- a/package.json +++ b/package.json @@ -41,6 +41,7 @@ "lint-staged": "^15.2.10", "prettier": "^3.3.3", "prettier-plugin-astro": "^0.14.1", + "sharp": "^0.33.5", "typescript": "^5.5.4", "typescript-eslint": "^8.4.0" } diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index af02c22..e781426 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -75,6 +75,9 @@ importers: prettier-plugin-astro: specifier: ^0.14.1 version: 0.14.1 + sharp: + specifier: ^0.33.5 + version: 0.33.5 typescript: specifier: ^5.5.4 version: 5.5.4 @@ -4313,13 +4316,11 @@ snapshots: dependencies: color-name: 1.1.4 simple-swizzle: 0.2.2 - optional: true color@4.2.3: dependencies: color-convert: 2.0.1 color-string: 1.9.1 - optional: true colorette@2.0.20: {} @@ -4399,8 +4400,7 @@ snapshots: dequal@2.0.3: {} - detect-libc@2.0.3: - optional: true + detect-libc@2.0.3: {} deterministic-object-hash@2.0.2: dependencies: @@ -4915,8 +4915,7 @@ snapshots: is-arrayish@0.2.1: {} - is-arrayish@0.3.2: - optional: true + is-arrayish@0.3.2: {} is-binary-path@2.1.0: dependencies: @@ -5939,7 +5938,6 @@ snapshots: '@img/sharp-wasm32': 0.33.5 '@img/sharp-win32-ia32': 0.33.5 '@img/sharp-win32-x64': 0.33.5 - optional: true shebang-command@2.0.0: dependencies: @@ -5958,7 +5956,6 @@ snapshots: simple-swizzle@0.2.2: dependencies: is-arrayish: 0.3.2 - optional: true sisteransi@1.0.5: {}