diff --git a/.github/workflows/cd.yml b/.github/workflows/cd.yml new file mode 100644 index 00000000..d051cce3 --- /dev/null +++ b/.github/workflows/cd.yml @@ -0,0 +1,52 @@ +name: Continuous Deployment + +env: + VERCEL_ORG_ID: ${{secrets.VERCEL_ORG_ID}} + VERCEL_PROJECT_ID: ${{secrets.VERCEL_PROJECT_ID}} + +on: + workflow_dispatch: + pull_request: + branches: + - develop +permissions: + contents: read + pull-requests: write +jobs: + Test_Build: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - name: Install dependencies + run: npm install + - name: Run test + run: npm run test --if-present + - name: Build + run: npm run build + + Deploy-Preview: + runs-on: ubuntu-latest + needs: [Test_Build] + steps: + - uses: actions/checkout@v2 + - name: Install Vercel CLI + run: npm install --global vercel@latest + - name: Pull Vercel Environment Info + 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 + id: deploy + run: echo "url=$(vercel deploy --prebuilt --token=${{secrets.VERCEL_TOKEN}})" >> $GITHUB_OUTPUT + + - name: Comment PR + uses: actions/github-script@v6 + with: + github-token: ${{secrets.GITHUB_TOKEN}} + script: | + github.rest.issues.createComment({ + issue_number: context.issue.number, + owner: context.repo.owner, + repo: context.repo.repo, + body: 'Vercel preview deployment is live at: ${{ steps.deploy.outputs.url }}' + }) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 00000000..2351562c --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,28 @@ +name: Continous Integration + +on: + workflow_dispatch: + push: + branches-ignore: + - develop + +jobs: + Build: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + + - name: Install Packages + run: npm install + - name: Build + run: npm run build + + Test: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + + - name: Install Packages + run: npm install + - name: Run tests + run: npm run test --if-present