build(deps-dev): update eslint
to ^8.57.1 - autoclosed
#346
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
# GitHub Actions References: | |
# https://docs.github.com/en/actions | |
name: ⚙🚀 | |
on: | |
push: | |
branches: [main] | |
pull_request: | |
types: [opened, synchronize] | |
jobs: | |
test_build: | |
name: ⚛ Test and Build ⚙ | |
strategy: | |
matrix: | |
os: [ubuntu-latest] | |
node: [17.x, "lts/*"] | |
runs-on: ${{ matrix.os }} | |
steps: | |
- name: 🛑 Cancel Previous Running Workflows | |
uses: styfle/cancel-workflow-action@0.9.1 | |
- name: 🛎️ Checkout | |
uses: actions/checkout@v2.4.0 | |
- name: 📦 Use Node.js ${{ matrix.node }} | |
uses: actions/setup-node@v2.5.1 | |
with: | |
node-version: ${{ matrix.node }} | |
cache: yarn | |
cache-dependency-path: "**/yarn.lock" | |
- name: ✨ Install Dependencies | |
run: yarn --immutable --check-cache | |
- name: 👓 Run Linter | |
run: yarn lint | |
- name: 💅 Run Formatter | |
run: yarn format | |
- name: 🧪 Run Tests | |
run: yarn test | |
- name: 🛠 Run Build | |
run: yarn build | |
- name: ♻ Cache dist Directory for Publish | |
uses: actions/cache@v2.1.7 | |
with: | |
path: | | |
./.yarn | |
./.yarnrc.yml | |
./dist | |
./package.json | |
./pm2.yml | |
./tsconfig-paths-bootstrap.js | |
./tsconfig.json | |
./yarn.lock | |
key: ${{ github.sha }}-${{ runner.os }}-${{ matrix.node }} | |
deploy: | |
name: 🚀 Deploy to Production ✨ | |
needs: test_build | |
if: github.event_name == 'push' && github.ref == 'refs/heads/main' | |
strategy: | |
matrix: | |
os: [ubuntu-latest] | |
node: ["lts/*"] | |
runs-on: ${{ matrix.os }} | |
steps: | |
- name: 🛑 Cancel Previous Running Workflows | |
uses: styfle/cancel-workflow-action@0.9.1 | |
- name: ⚙ Configure SSH | |
env: | |
SSH_USER: ${{ secrets.PRODUCTION_SSH_USER }} | |
SSH_HOST: ${{ secrets.PRODUCTION_SSH_HOST }} | |
SSH_PORT: ${{ secrets.PRODUCTION_SSH_PORT }} | |
SSH_KEY: ${{ secrets.PRODUCTION_SSH_KEY }} | |
run: | | |
mkdir -p ~/.ssh/ | |
echo "$SSH_KEY" > ~/.ssh/production.key | |
chmod 600 ~/.ssh/production.key | |
cat <<EOF >~/.ssh/config | |
Host production | |
HostName $SSH_HOST | |
User $SSH_USER | |
Port $SSH_PORT | |
IdentityFile ~/.ssh/production.key | |
BatchMode yes | |
StrictHostKeyChecking no | |
EOF | |
- name: ♻ Restore dist Directory for Publish | |
id: restore-dist | |
uses: actions/cache@v2.1.7 | |
with: | |
path: | | |
./.yarn | |
./.yarnrc.yml | |
./dist | |
./package.json | |
./pm2.yml | |
./tsconfig-paths-bootstrap.js | |
./tsconfig.json | |
./yarn.lock | |
key: ${{ github.sha }}-${{ runner.os }}-${{ matrix.node }} | |
- name: 🌏 Setup Remote Host ENV | |
env: | |
DISCORD_TOKEN: ${{ secrets.PRODUCTION_DISCORD_TOKEN }} | |
DB_URI: ${{ secrets.PRODUCTION_DB_URI }} | |
run: | | |
cat <<EOF >./.env | |
NODE_ENV=production | |
DISCORD__BOT_TOKEN=$DISCORD_TOKEN | |
DB_URI=$DB_URI | |
PREFIX= | |
EOF | |
- name: 🆙 Upload Build State to Remote Host | |
run: rsync -rltDvzOh --delete ./ production:${{ secrets.PRODUCTION_SSH_PATH }} | |
- name: ✨ Install Dependencies in Remote Host | |
run: ssh production 'cd ${{ secrets.PRODUCTION_SSH_PATH }} && yarn workspaces focus --all --production' | |
- name: 🐥 Run Emperor Ruppy | |
run: ssh production 'if pm2 describe emperor-ruppy; then pm2 restart emperor-ruppy; else cd ${{ secrets.PRODUCTION_SSH_PATH }} && yarn start; fi' |