From 13ae74e8783d24e1041e46fe08a93155d5a0718b Mon Sep 17 00:00:00 2001 From: Girish21 Date: Sat, 11 Jun 2022 16:06:36 +0530 Subject: [PATCH] add CI actions for lints and deploy --- .github/workflows/ci.yml | 45 ++++++++++++++++++++++++++++++++++++ .github/workflows/deploy.yml | 30 ++++++++++++++++++++++++ package.json | 2 +- 3 files changed, 76 insertions(+), 1 deletion(-) create mode 100644 .github/workflows/ci.yml create mode 100644 .github/workflows/deploy.yml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..f2ce8ef --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,45 @@ +name: ๐Ÿงช CI +on: [push, pull_request] + +jobs: + lint: + name: โฌฃ ESLint + runs-on: ubuntu-latest + steps: + - name: ๐Ÿ›‘ Cancel Previous Runs + uses: styfle/cancel-workflow-action@0.9.1 + + - name: โฌ‡๏ธ Checkout repo + uses: actions/checkout@v3 + + - name: โŽ” Setup node + uses: actions/setup-node@v3 + with: + node-version: 16.7.0 + + - name: ๐Ÿ“ฅ Download deps + uses: bahmutov/npm-install@v1 + + - name: ๐Ÿ”ฌ Lint + run: npm run lint + + typecheck: + name: สฆ Typecheck + runs-on: ubuntu-latest + steps: + - name: ๐Ÿ›‘ Cancel Previous Runs + uses: styfle/cancel-workflow-action@0.9.1 + + - name: โฌ‡๏ธ Checkout repo + uses: actions/checkout@v3 + + - name: โŽ” Setup node + uses: actions/setup-node@v3 + with: + node-version: 16.7.0 + + - name: ๐Ÿ“ฅ Download deps + uses: bahmutov/npm-install@v1 + + - name: ๐Ÿ”Ž Type check + run: npm run typecheck diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml new file mode 100644 index 0000000..e65eda2 --- /dev/null +++ b/.github/workflows/deploy.yml @@ -0,0 +1,30 @@ +name: ๐Ÿ•Š Deploy +on: + push: + branches: + - master + +jobs: + deploy: + if: github.repository == 'Girish21/remix-cloudflare-workers-template' + runs-on: ubuntu-latest + name: ๐Ÿ•Š Deploy + steps: + - name: ๐Ÿ›‘ Cancel Previous Runs + uses: styfle/cancel-workflow-action@0.9.1 + + - name: โฌ‡๏ธ Checkout repo + uses: actions/checkout@v3 + + - name: ๐Ÿ“ฅ Install deps + uses: bahmutov/npm-install@v1 + + - name: ๐Ÿ“ฆ Build + run: npm run build + + - name: ๐Ÿš€ Publish + uses: cloudflare/wrangler-action@2.0.0 + with: + apiToken: ${{ secrets.CF_API_TOKEN }} + workingDirectory: 'packages/worker' + command: publish diff --git a/package.json b/package.json index 80c68de..e86f860 100644 --- a/package.json +++ b/package.json @@ -11,7 +11,7 @@ "dev": "npx --yes turbo run dev --parallel", "lint": "npx --yes turbo run lint", "typecheck": "npx --yes turbo run typecheck", - "format": "prettier --write \"**/*.{ts,tsx,js,jsx,md}\"" + "format": "prettier --write \"**/*.{ts,tsx,js,jsx,md,yml}\"" }, "devDependencies": { "prettier": "latest",