Skip to content

fix: title message

fix: title message #25

Workflow file for this run

name: deploy to preview
on:
push:
branches: [main]
permissions:
contents: write
deployments: write
pull-requests: write
jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '20'
cache: 'npm'
- name: Install dependencies
run: npm ci
- name: Run tests
run: npm run test:run
- name: Generate coverage report
run: npm run test:coverage
continue-on-error: true
- name: Upload coverage report
uses: actions/upload-artifact@v4
if: always()
with:
name: coverage-report
path: coverage/
retention-days: 30
deploy:
needs: test
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: restore npm cache
uses: actions/cache@v3
with:
path: ~/.npm
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-node-
- name: install deps and pull vercel
run: |
npm i vercel --global && npx vercel pull --yes --token=${VERCEL_TOKEN}
env:
VERCEL_PROJECT_ID: ${{ secrets.VERCEL_PREVIEW_PROJECT_ID }}
VERCEL_ORG_ID: ${{ secrets.VERCEL_PREVIEW_ORG_ID }}
VERCEL_TOKEN: ${{ secrets.VERCEL_TOKEN }}
- name: deploy to preview
id: vercel-deploy
uses: amondnet/vercel-action@v25
with:
vercel-token: ${{ secrets.VERCEL_TOKEN }}
github-token: ${{ secrets.GITHUB_TOKEN }}
vercel-args: "--prod"
vercel-org-id: ${{ secrets.VERCEL_PREVIEW_ORG_ID}}
vercel-project-id: ${{ secrets.VERCEL_PREVIEW_PROJECT_ID}}
- name: Delete old preview deployments
id: delete_old_deployments
run: |
DEPLOYMENTS=$(curl -s -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" "https://api.github.com/repos/${{ github.repository }}/deployments")
echo "$DEPLOYMENTS" | jq '.[] | select(.environment=="preview") | .id' | while read deployment_id; do
curl -X DELETE -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" "https://api.github.com/repos/${{ github.repository }}/deployments/$deployment_id"
done
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: gitHub preview deployment
uses: chrnorm/deployment-action@v2
with:
token: '${{ github.token }}'
environment-url: https://preview-gamix-frontend.vercel.app
environment: 'preview'
initial-status: 'success'
transient-environment: false
production-environment: true