diff --git a/.github/workflows/default.yaml b/.github/workflows/default.yaml index 0d42828..87b7c38 100644 --- a/.github/workflows/default.yaml +++ b/.github/workflows/default.yaml @@ -1,8 +1,8 @@ -name: Deploy to GitHub Pages +name: Deploy to SFTP Server on: push: - branches: [ main ] + branches: [main] permissions: contents: read @@ -12,32 +12,33 @@ permissions: jobs: build: env: - RUNNER_TOOL_CACHE: /toolcache + RUNNER_TOOL_CACHE: '/toolcache' runs-on: ubuntu-latest steps: - - name: Checkout + - name: 🔄 Checkout code uses: actions/checkout@v3 - - name: 📦 Install git-lfs - run: apt update && apt install git-lfs zstd - - - name: 🔢 Calculate cache ids + - name: 📦 Install Git LFS run: | + apt update && apt install git-lfs zstd + + - name: 🔢 Calculate cache IDs + run: | + # Calculate cache IDs for Git LFS and PNPM git lfs ls-files -l | cut -d' ' -f1 | sort > .lfs-assets-id - LFS_CACHE_ID=$(cat .lfs-assets-id | md5sum)-v1 # Get the GitHub repository name - PNPM_CACHE_ID=$( cat pnpm-lock.yaml | md5sum )-v1 + LFS_CACHE_ID=$(cat .lfs-assets-id | md5sum)-v1 + PNPM_CACHE_ID=$(cat pnpm-lock.yaml | md5sum)-v1 echo "LFS_CACHE_ID=$LFS_CACHE_ID" >> $GITHUB_ENV echo "PNPM_STORE_PATH=$(pnpm store path)" >> $GITHUB_ENV echo "PNPM_CACHE_ID=$PNPM_CACHE_ID" >> $GITHUB_ENV - - name: LFS Cache - uses: actions/cache@v3 + - name: 🗄️ Cache Git LFS objects + uses: actions/cache@v4 with: - path: .git/lfs/objects + path: .git/lfs key: ${{ runner.os }}-lfs-${{ env.LFS_CACHE_ID }} - restore-keys: | - - name: Install Node.js + - name: 📥 Install Node.js uses: actions/setup-node@v4 with: node-version: 20 @@ -50,24 +51,19 @@ jobs: node_version: 20 run_install: false - - name: Get pnpm store directory - shell: bash - run: | - echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV - - - uses: actions/cache@v4 - name: Setup pnpm cache + - name: 🛠️ Cache PNPM dependencies + uses: actions/cache@v4 with: path: ${{ env.STORE_PATH }} key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }} - restore-keys: | - ${{ runner.os }}-pnpm-store- - - name: Checkout LFS Files + - name: 🔄 Pull Git LFS files run: git lfs pull - - name: Install, build, and upload your site output - run: pnpm i && pnpm build + - name: 🏗️ Build site + run: | + # Install dependencies, build, and generate site output + pnpm i && pnpm build - name: 🚀 Deploy files via SFTP uses: pressidium/lftp-mirror-action@v1 @@ -82,3 +78,4 @@ jobs: localDir: 'dist' remoteDir: '/share/new-website' options: '--verbose' +