-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
9e5a9f1
commit 3c0de03
Showing
6 changed files
with
240 additions
and
33 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
name: CI Workflow | ||
|
||
on: | ||
pull_request: | ||
branches: '**' | ||
workflow_dispatch: | ||
|
||
jobs: | ||
init: | ||
name: Initial common steps | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: 🛎️ Checkout | ||
uses: actions/checkout@v3 | ||
|
||
- name: ⚙️ Setup PNPM | ||
uses: pnpm/action-setup@v2.2.1 | ||
with: | ||
version: 8 | ||
|
||
- name: 📝 Cache dependencies | ||
id: cache-deps | ||
uses: actions/cache@v3 | ||
with: | ||
path: node_modules | ||
key: deps-node-modules-${{ hashFiles('**/pnpm-lock.yaml') }} | ||
|
||
- name: 🔧 Install dependencies | ||
if: steps.cache-deps.outputs.cache-hit != 'true' | ||
run: pnpm install --frozen-lockfile | ||
|
||
test: | ||
name: Test Coverage | ||
runs-on: ubuntu-latest | ||
environment: Test | ||
timeout-minutes: 10 | ||
needs: init | ||
|
||
- name: 🛎️ Checkout | ||
uses: actions/checkout@v3 | ||
|
||
- name: ⚙️ Setup PNPM | ||
uses: pnpm/action-setup@v2.2.1 | ||
with: | ||
version: 8 | ||
|
||
- name: 📝 Cache dependencies | ||
id: cache-deps | ||
uses: actions/cache@v3 | ||
with: | ||
path: node_modules | ||
key: deps-node-modules-${{ hashFiles('**/pnpm-lock.yaml') }} | ||
|
||
- name: 🔧 Install dependencies | ||
if: steps.cache-deps.outputs.cache-hit != 'true' | ||
run: pnpm install --frozen-lockfile | ||
|
||
- name: 🧪 Test Coverage | ||
run: pnpm test:coverage | ||
|
||
- name: 📈 Upload coverage reports to Codecov | ||
uses: codecov/codecov-action@v3 | ||
with: | ||
token: ${{ secrets.CODECOV_TOKEN }} | ||
fail_ci_if_error: true |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
name: Cleanup Branch Resource | ||
|
||
permissions: | ||
actions: write | ||
contents: read | ||
|
||
on: | ||
pull_request: | ||
types: | ||
- closed | ||
workflow_dispatch: | ||
|
||
jobs: | ||
cleanup: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: 🛎️ Checkout | ||
uses: actions/checkout@v3 | ||
|
||
- name: 🗑️ Cleanup cache | ||
run: | | ||
gh extension install actions/gh-actions-cache | ||
REPO=${{ github.repository }} | ||
BRANCH=refs/pull/${{ github.event.pull_request.number }}/merge | ||
echo "Fetching list of cache key" | ||
cacheKeysForPR=$(gh actions-cache list -R $REPO -B $BRANCH | cut -f 1 ) | ||
echo "Cache keys for PR: $cacheKeysForPR" | ||
## Setting this to not fail the workflow while deleting cache keys. | ||
set +e | ||
echo "Deleting caches..." | ||
for cacheKey in $cacheKeysForPR | ||
do | ||
echo "- ${cacheKey}" | ||
gh actions-cache delete $cacheKey -R $REPO -B $BRANCH --confirm | ||
done | ||
echo "Done" | ||
env: | ||
GH_TOKEN: ${{ github.token }} | ||
|
||
- name: ⚰️ Delete artifacts | ||
run: | | ||
PR_NUMBER=${{ github.event.pull_request.number }} | ||
artifacts=$(gh api /repos/${{ github.repository }}/actions/artifacts --paginate) | ||
for artifact in $(echo "$artifacts" | jq -r ".artifacts[] | select(.name | startswith(\"PR-$PR_NUMBER-\")) | .id"); do | ||
echo "filtered artifact: $artifact" | ||
gh api -X DELETE /repos/${{ github.repository }}/actions/artifacts/$artifact | ||
done | ||
env: | ||
GH_TOKEN: ${{ github.token }} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,85 @@ | ||
name: Vercel Preview Deployment | ||
|
||
env: | ||
VERCEL_ORG_ID: ${{ secrets.VERCEL_ORG_ID }} | ||
VERCEL_PROJECT_ID: ${{ secrets.VERCEL_PROJECT_ID }} | ||
|
||
on: | ||
push: | ||
branches-ignore: | ||
- main | ||
|
||
jobs: | ||
init: | ||
name: Initial common steps | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: 🛎️ Checkout | ||
uses: actions/checkout@v3 | ||
|
||
- name: ⚙️ Setup PNPM | ||
uses: pnpm/action-setup@v2.2.1 | ||
with: | ||
version: 8 | ||
|
||
- name: 📝 Cache dependencies | ||
id: cache-deps | ||
uses: actions/cache@v3 | ||
with: | ||
path: node_modules | ||
key: deps-node-modules-${{ hashFiles('**/pnpm-lock.yaml') }} | ||
|
||
- name: 🔧 Install dependencies | ||
if: steps.cache-deps.outputs.cache-hit != 'true' | ||
run: pnpm install --frozen-lockfile | ||
|
||
test: | ||
name: Test | ||
runs-on: ubuntu-latest | ||
needs: init | ||
|
||
- name: 🛎️ Checkout | ||
uses: actions/checkout@v3 | ||
|
||
- name: ⚙️ Setup PNPM | ||
uses: pnpm/action-setup@v2.2.1 | ||
with: | ||
version: 8 | ||
|
||
- name: 📝 Cache dependencies | ||
id: cache-deps | ||
uses: actions/cache@v3 | ||
with: | ||
path: node_modules | ||
key: deps-node-modules-${{ hashFiles('**/pnpm-lock.yaml') }} | ||
|
||
- name: 🔧 Install dependencies | ||
if: steps.cache-deps.outputs.cache-hit != 'true' | ||
run: pnpm install --frozen-lockfile | ||
|
||
- name: 🧪 Test | ||
run: pnpm test | ||
|
||
preview: | ||
name: Deploy preview | ||
runs-on: ubuntu-latest | ||
environment: Preview | ||
timeout-minutes: 10 | ||
needs: test | ||
|
||
steps: | ||
- name: 🛎️ Checkout | ||
uses: actions/checkout@v3 | ||
|
||
- name: 🔧 Install Vercel CLI | ||
run: npm install --global vercel@latest | ||
|
||
- name: 👔 Pull Vercel Environment Information | ||
run: vercel pull --yes --environment=preview --token=${{ secrets.VERCEL_TOKEN }} | ||
|
||
- name: 👷 Build Project Artifacts | ||
run: vercel build --token=${{ secrets.VERCEL_TOKEN }} | ||
|
||
- name: 🚀 Deploy Project Artifacts to Vercel | ||
run: vercel deploy --prebuilt --token=${{ secrets.VERCEL_TOKEN }} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
name: Vercel Production Deployment | ||
|
||
env: | ||
VERCEL_ORG_ID: ${{ secrets.VERCEL_ORG_ID }} | ||
VERCEL_PROJECT_ID: ${{ secrets.VERCEL_PROJECT_ID }} | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
|
||
jobs: | ||
production: | ||
name: Deploy production | ||
runs-on: ubuntu-latest | ||
environment: Production | ||
timeout-minutes: 10 | ||
|
||
steps: | ||
- name: 🛎️ Checkout | ||
uses: actions/checkout@v3 | ||
|
||
- name: 🔧 Install Vercel CLI | ||
run: npm install --global vercel@latest | ||
|
||
- name: 👔 Pull Vercel Environment Information | ||
run: vercel pull --yes --environment=production --token=${{ secrets.VERCEL_TOKEN }} | ||
|
||
- name: 👷 Build Project Artifacts | ||
run: vercel build --prod --token=${{ secrets.VERCEL_TOKEN }} | ||
|
||
- name: 🚀 Deploy Project Artifacts to Vercel | ||
run: vercel deploy --prebuilt --prod --token=${{ secrets.VERCEL_TOKEN }} |
This file was deleted.
Oops, something went wrong.
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