Co-authored-by: Hewston Fox <hewstonfox@gmail.com> Co-authored-by: autofix <noreply@autofix.ci> Reviewed-on: #1
This commit was merged in pull request #1.
This commit is contained in:
63
.gitea/workflows/autofix.ci.yaml
Normal file
63
.gitea/workflows/autofix.ci.yaml
Normal file
@@ -0,0 +1,63 @@
|
||||
# Check and format a branch on a pull request created.
|
||||
name: autofix.ci
|
||||
on:
|
||||
pull_request:
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
|
||||
jobs:
|
||||
prepare:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout
|
||||
run: |
|
||||
GITEA_HOST="${GITEA_HOST_IP:-172.20.0.1}"
|
||||
git clone --depth 1 "http://oauth2:${GITHUB_TOKEN}@${GITEA_HOST}:3000/${{ github.repository }}.git" .
|
||||
git fetch --depth 1 origin "${{ github.sha }}"
|
||||
git checkout -q "${{ github.sha }}"
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ github.token }}
|
||||
GITEA_HOST_IP: ${{ secrets.GITEA_HOST_IP }}
|
||||
|
||||
- name: Setup pnpm
|
||||
uses: pnpm/action-setup@v4
|
||||
with:
|
||||
version: 10.30.3
|
||||
run_install: false
|
||||
|
||||
- name: Configure pnpm store
|
||||
run: pnpm config set store-dir /root/.pnpm-store
|
||||
|
||||
- name: Setup Node.js
|
||||
uses: actions/setup-node@v6
|
||||
with:
|
||||
node-version-file: ".nvmrc"
|
||||
|
||||
- name: Cache pnpm store
|
||||
uses: actions/cache@v4
|
||||
with:
|
||||
path: /root/.pnpm-store
|
||||
key: pnpm-${{ hashFiles('pnpm-lock.yaml') }}
|
||||
restore-keys: pnpm-
|
||||
|
||||
- name: Install dependencies
|
||||
run: pnpm install --frozen-lockfile
|
||||
|
||||
- name: Lint
|
||||
run: pnpm run lint
|
||||
|
||||
- name: Format
|
||||
run: pnpm run fmt
|
||||
|
||||
- name: Commit fixes
|
||||
run: |
|
||||
GITEA_HOST="${GITEA_HOST_IP:-172.20.0.1}"
|
||||
git config user.name "autofix"
|
||||
git config user.email "noreply@autofix.ci"
|
||||
git diff --quiet && git diff --staged --quiet || \
|
||||
git commit -am "autofix: format" && \
|
||||
git push "http://oauth2:${GITHUB_TOKEN}@${GITEA_HOST}:3000/${{ github.repository }}.git" HEAD:${{ github.head_ref }}
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ github.token }}
|
||||
GITEA_HOST_IP: ${{ secrets.GITEA_HOST_IP }}
|
||||
@@ -43,19 +43,19 @@ jobs:
|
||||
- name: Setup pnpm
|
||||
uses: pnpm/action-setup@v4
|
||||
with:
|
||||
version: 10.20.0
|
||||
version: 10.30.3
|
||||
|
||||
- name: Setup Node.js
|
||||
uses: actions/setup-node@v4
|
||||
uses: actions/setup-node@v6
|
||||
with:
|
||||
node-version: 20
|
||||
node-version-file: ".nvmrc"
|
||||
cache: "pnpm"
|
||||
|
||||
# Requires pnpm-lock.yaml in the repo (run `pnpm install` locally once and commit the lockfile).
|
||||
- name: Install dependencies and build
|
||||
run: |
|
||||
pnpm install --frozen-lockfile
|
||||
pnpm run build
|
||||
- name: Install dependencies
|
||||
run: pnpm install --frozen-lockfile
|
||||
|
||||
- name: Build
|
||||
run: pnpm run build
|
||||
|
||||
- name: Deploy dist to VPS dist
|
||||
run: |
|
||||
@@ -64,4 +64,4 @@ jobs:
|
||||
REMOTE_DIR="/opt/app/frontend/dist"
|
||||
ssh -i ~/.ssh/deploy_key -o StrictHostKeyChecking=accept-new "$USER@$HOST" "mkdir -p $REMOTE_DIR"
|
||||
scp -i ~/.ssh/deploy_key -o StrictHostKeyChecking=accept-new -r dist/* "$USER@$HOST:$REMOTE_DIR/"
|
||||
echo "Deployed to $USER@$HOST:$REMOTE_DIR/"
|
||||
echo "Deployed to $USER@$HOST:$REMOTE_DIR/"
|
||||
|
||||
Reference in New Issue
Block a user