feat: annoying tax #7431
Workflow file for this run
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
name: ci | |
on: | |
push: | |
branches: [main] | |
pull_request: | |
branches: [main] | |
jobs: | |
test: | |
name: tests | |
runs-on: ubuntu-latest | |
steps: | |
- name: checkout repository | |
uses: actions/checkout@v4 | |
- name: setup node | |
uses: actions/setup-node@v4 | |
with: | |
node-version: 18 | |
- uses: pnpm/action-setup@v4 | |
name: install pnpm | |
id: pnpm-install | |
with: | |
version: latest | |
run_install: false | |
- name: get pnpm store directory | |
id: pnpm-cache | |
shell: bash | |
run: | | |
echo "STORE_PATH=$(pnpm store path)" >> $GITHUB_OUTPUT | |
- uses: actions/cache@v4 | |
name: setup pnpm cache | |
with: | |
path: ${{ steps.pnpm-cache.outputs.STORE_PATH }} | |
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }} | |
restore-keys: | | |
${{ runner.os }}-pnpm-store- | |
- name: install dependencies | |
run: pnpm install --frozen-lockfile | |
- name: run setup.sh | |
run: bash ${GITHUB_WORKSPACE}/setup.sh | |
- name: setup prisma | |
run: npx prisma generate | |
- name: build | |
run: npx tsc | |
- name: run tests | |
run: npx jest | |
lint: | |
name: linting | |
runs-on: ubuntu-latest | |
steps: | |
- name: checkout repository | |
uses: actions/checkout@v4 | |
- name: setup node | |
uses: actions/setup-node@v4 | |
with: | |
node-version: 18 | |
- uses: pnpm/action-setup@v4 | |
name: install pnpm | |
id: pnpm-install | |
with: | |
version: latest | |
run_install: false | |
- name: get pnpm store directory | |
id: pnpm-cache | |
shell: bash | |
run: | | |
echo "STORE_PATH=$(pnpm store path)" >> $GITHUB_OUTPUT | |
- uses: actions/cache@v4 | |
name: setup pnpm cache | |
with: | |
path: ${{ steps.pnpm-cache.outputs.STORE_PATH }} | |
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }} | |
restore-keys: | | |
${{ runner.os }}-pnpm-store- | |
- name: install dependencies | |
run: pnpm install --frozen-lockfile | |
- name: run setup.sh | |
run: bash ${GITHUB_WORKSPACE}/setup.sh | |
- name: setup prisma | |
run: npx prisma generate | |
- name: build | |
run: npx tsc | |
- name: linting | |
run: npx eslint ./src/ | |
deploy: | |
if: github.ref == 'refs/heads/main' | |
needs: [lint, test] | |
concurrency: deploy | |
runs-on: ubuntu-latest | |
steps: | |
- name: start deployment | |
uses: bobheadxi/deployments@v1 | |
id: deployment | |
with: | |
step: start | |
token: ${{ secrets.GITHUB_TOKEN }} | |
env: prod | |
- name: checkout repository | |
uses: actions/checkout@v4 | |
- name: setup node | |
uses: actions/setup-node@v4 | |
with: | |
node-version: 18 | |
- uses: pnpm/action-setup@v4 | |
name: install pnpm | |
id: pnpm-install | |
with: | |
version: latest | |
run_install: false | |
- name: get pnpm store directory | |
id: pnpm-cache | |
shell: bash | |
run: | | |
echo "STORE_PATH=$(pnpm store path)" >> $GITHUB_OUTPUT | |
- uses: actions/cache@v4 | |
name: setup pnpm cache | |
with: | |
path: ${{ steps.pnpm-cache.outputs.STORE_PATH }} | |
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }} | |
restore-keys: | | |
${{ runner.os }}-pnpm-store- | |
- name: Install dependencies | |
run: pnpm install --frozen-lockfile | |
- name: run setup.sh | |
run: bash ${GITHUB_WORKSPACE}/setup.sh | |
- name: setup prisma | |
run: npx prisma generate | |
- name: build | |
run: npx tsc | |
- name: prepare files for deploy | |
run: | | |
mkdir deploy | |
mv dist/ deploy/ | |
mv package.json deploy/ | |
mv pnpm-lock.yaml deploy/ | |
mv data/ deploy/ | |
mv prisma/ deploy/ | |
mv tsconfig.json deploy/ | |
rm deploy/dist/utils/functions/anticheat.js | |
- name: deploy | |
uses: nogsantos/scp-deploy@master | |
with: | |
src: ./deploy/* | |
host: ${{ secrets.HOST }} | |
remote: ./nypsi/ | |
port: 22 | |
user: ${{ secrets.USERNAME }} | |
key: ${{ secrets.SSH_KEY }} | |
- name: connect to server & update packages | |
uses: appleboy/ssh-action@master | |
with: | |
host: ${{ secrets.HOST }} | |
username: ${{ secrets.USERNAME }} | |
port: 22 | |
key: ${{ secrets.SSH_KEY }} | |
script: | | |
cd ~/nypsi | |
nvm use lts | |
npm i -g pnpm | |
pnpm install --frozen-lockfile | |
- name: update deployment status | |
uses: bobheadxi/deployments@v1 | |
if: always() | |
with: | |
step: finish | |
token: ${{ secrets.GITHUB_TOKEN }} | |
status: ${{ job.status }} | |
env: ${{ steps.deployment.outputs.env }} | |
deployment_id: ${{ steps.deployment.outputs.deployment_id }} |