diff --git a/.github/workflows/production.yaml b/.github/workflows/production.yaml new file mode 100644 index 0000000..f6397c9 --- /dev/null +++ b/.github/workflows/production.yaml @@ -0,0 +1,38 @@ +name: Production Deployment + +on: + release: + types: [published] + +jobs: + deploy_staging: + name: Deploy Production + runs-on: ubuntu-latest + environment: + name: production + url: ${{ vars.ENV_URL }} + + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Install node + uses: actions/setup-node@v4 + with: + node-version: '21.1.0' + + - name: Install dependencies + run: npm install + + - name: Build code, then publish to Vercel + run: > + vercel + --token ${{ secrets.VERCEL_TOKEN }} + -n ${{ vars.VERCEL_PROJECT }} + --yes + --prod + --env NEXT_PUBLIC_CMS_URL=${{ vars.NEXT_PUBLIC_CMS_URL }} + --build-env NEXT_PUBLIC_CMS_URL=${{ vars.NEXT_PUBLIC_CMS_URL }} + + - name: Success + run: echo "🚀 Deploy successful 🚀 " diff --git a/.github/workflows/staging.yaml b/.github/workflows/staging.yaml new file mode 100644 index 0000000..61bf433 --- /dev/null +++ b/.github/workflows/staging.yaml @@ -0,0 +1,39 @@ +name: Staging Deployment + +on: + push: + branches: + - 'main' + +jobs: + deploy_staging: + name: Deploy Staging + runs-on: ubuntu-latest + environment: + name: staging + url: ${{ vars.ENV_URL }} + + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Install node + uses: actions/setup-node@v4 + with: + node-version: '21.1.0' + + - name: Install dependencies + run: npm install + + - name: Build code, then publish to Vercel + run: > + vercel + --token ${{ secrets.VERCEL_TOKEN }} + -n ${{ vars.VERCEL_PROJECT }} + --yes + --prod + --env NEXT_PUBLIC_CMS_URL=${{ vars.NEXT_PUBLIC_CMS_URL }} + --build-env NEXT_PUBLIC_CMS_URL=${{ vars.NEXT_PUBLIC_CMS_URL }} + + - name: Success + run: echo "🛠️ Deploy successful 🛠️" diff --git a/.gitignore b/.gitignore index bc819bc..d286c99 100755 --- a/.gitignore +++ b/.gitignore @@ -27,6 +27,7 @@ yarn-error.log* # local env files .env*.local +.env # vercel .vercel