Skip to content

update package.json #80

update package.json

update package.json #80

Workflow file for this run

name: CI/CD
on:
push:
branches:
- main
env:
CHECKLY_API_KEY: ${{ secrets.CHECKLY_API_KEY }}
CHECKLY_ACCOUNT_ID: ${{ secrets.CHECKLY_ACCOUNT_ID }}
jobs:
deploy:
runs-on: ubuntu-latest
environment: "Ubuntu in the sky"
steps:
- name: Set up SSH
run: |
mkdir -p ~/.ssh
echo "${{ secrets.KEY }}" > ~/.ssh/deploy_key
chmod 600 ~/.ssh/deploy_key
ls -la ~/.ssh/deploy_key
echo "Key file contents (first line only):"
head -n 1 ~/.ssh/deploy_key
ssh-keygen -l -f ~/.ssh/deploy_key || echo "Invalid key format"
- name: Add host key
run: ssh-keyscan -p ${{ secrets.PORT }} ${{ secrets.HOST }} >> ~/.ssh/known_hosts
- name: Deploy to VPS
run: |
ssh -i ~/.ssh/deploy_key -p ${{ secrets.PORT }} ${{ secrets.USERNAME }}@${{ secrets.HOST }} << 'EOF'
cd /var/www/portfolio
git pull --rebase origin main
EOF
test:
needs: deploy
runs-on: ubuntu-latest
environment: "Ubuntu in the sky"
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Setup node
uses: actions/setup-node@v3
with:
node-version: '20'
- name: Restore or cache node_modules
id: cache-node-modules
uses: actions/cache@v3
with:
path: node_modules
key: node-modules-${{ hashFiles('package-lock.json') }}
- name: Install dependencies
if: steps.cache-node-modules.outputs.cache-hit != 'true'
run: npm ci
#- name: Checkly Login
# id: checkly-login
# run: npx checkly login
- name: Run checks
id: run-checks
run: npx checkly test
- name: Deploy checks
id: deploy-checks
if: steps.run-checks.outcome == 'success'
run: npx checkly deploy --force