移除验证作业,简化 CI/CD 流程
This commit is contained in:
@@ -11,91 +11,8 @@ on:
|
||||
- "latest"
|
||||
|
||||
jobs:
|
||||
validate:
|
||||
runs-on: ubuntu-22.04
|
||||
permissions:
|
||||
contents: read
|
||||
defaults:
|
||||
run:
|
||||
shell: bash
|
||||
|
||||
steps:
|
||||
- name: Checkout code
|
||||
env:
|
||||
SERVER_URL: ${{ github.server_url }}
|
||||
REPOSITORY: ${{ github.repository }}
|
||||
COMMIT_SHA: ${{ github.sha }}
|
||||
GIT_USERNAME: ${{ github.actor }}
|
||||
GIT_TOKEN: ${{ github.token }}
|
||||
run: |
|
||||
case "$SERVER_URL" in
|
||||
http://*)
|
||||
AUTH_SERVER_URL="http://${GIT_USERNAME}:${GIT_TOKEN}@${SERVER_URL#http://}"
|
||||
;;
|
||||
https://*)
|
||||
AUTH_SERVER_URL="https://${GIT_USERNAME}:${GIT_TOKEN}@${SERVER_URL#https://}"
|
||||
;;
|
||||
*)
|
||||
AUTH_SERVER_URL="$SERVER_URL"
|
||||
;;
|
||||
esac
|
||||
|
||||
if [ ! -d .git ]; then
|
||||
git init .
|
||||
fi
|
||||
|
||||
if git remote get-url origin >/dev/null 2>&1; then
|
||||
git remote set-url origin "${AUTH_SERVER_URL}/${REPOSITORY}.git"
|
||||
else
|
||||
git remote add origin "${AUTH_SERVER_URL}/${REPOSITORY}.git"
|
||||
fi
|
||||
|
||||
git fetch --depth=1 origin "$COMMIT_SHA"
|
||||
git checkout --force --detach FETCH_HEAD
|
||||
git clean -ffdx
|
||||
|
||||
- name: Install Bun
|
||||
run: |
|
||||
set -euo pipefail
|
||||
|
||||
case "$(uname -m)" in
|
||||
x86_64)
|
||||
BUN_ARCH="x64"
|
||||
;;
|
||||
aarch64|arm64)
|
||||
BUN_ARCH="aarch64"
|
||||
;;
|
||||
*)
|
||||
echo "Unsupported architecture: $(uname -m)"
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
|
||||
BUN_ASSET="bun-linux-${BUN_ARCH}.zip"
|
||||
BUN_URL="https://ghfast.top/https://github.com/oven-sh/bun/releases/latest/download/${BUN_ASSET}"
|
||||
|
||||
rm -f /tmp/bun.zip
|
||||
echo "Trying Bun download: ${BUN_URL}"
|
||||
if ! curl -fL --connect-timeout 15 --max-time 180 --retry 2 --retry-delay 3 "$BUN_URL" -o /tmp/bun.zip; then
|
||||
echo "Failed to download Bun from configured mirror."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
rm -rf "$HOME/.bun"
|
||||
mkdir -p "$HOME/.bun/bin"
|
||||
unzip -qo /tmp/bun.zip -d /tmp
|
||||
install -m 0755 "/tmp/bun-linux-${BUN_ARCH}/bun" "$HOME/.bun/bin/bun"
|
||||
echo "$HOME/.bun/bin" >> "$GITHUB_PATH"
|
||||
|
||||
- name: Install dependencies
|
||||
run: bun install --frozen-lockfile
|
||||
|
||||
- name: Run checks
|
||||
run: bun run check
|
||||
|
||||
docker-image:
|
||||
runs-on: ubuntu-22.04
|
||||
needs: validate
|
||||
if: startsWith(github.ref, 'refs/tags/')
|
||||
permissions:
|
||||
contents: read
|
||||
|
||||
Reference in New Issue
Block a user