feat: add some ci
Some checks failed
Deploy to GitHub Pages / deploy (push) Has been cancelled
Deploy to GitHub Pages / build (push) Has been cancelled

This commit is contained in:
max_richter 2024-04-03 16:35:52 +02:00
parent e4b941a1dc
commit 91e60bb090

View File

@ -11,9 +11,30 @@ permissions:
jobs: jobs:
build: build:
runs-on: ubuntu-latest
steps: steps:
- name: Checkout your repository using git - name: Checkout your repository using git
uses: actions/checkout@v4 uses: actions/checkout@v4
- name: 📦 Install git-lfs
run: apt update && apt install git-lfs zstd
- name: 📦 Install PNPM
uses: https://github.com/pnpm/action-setup@v2
id: pnpm-install
with:
version: 7
run_install: false
- name: 🔢 Calculate cache ids
run: |
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
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: 🗳️ Setup pnpm cache - name: 🗳️ Setup pnpm cache
uses: https://github.com/actions/cache@v3 uses: https://github.com/actions/cache@v3
with: with:
@ -21,8 +42,15 @@ jobs:
key: ${{ runner.os }}-pnpm-store-${{ env.PNPM_CACHE_ID }} key: ${{ runner.os }}-pnpm-store-${{ env.PNPM_CACHE_ID }}
restore-keys: | restore-keys: |
${{ runner.os }}-pnpm-store ${{ runner.os }}-pnpm-store
- name: Install, build, and upload your site
uses: withastro/action@v2 - name: 📥 Checkout lfs files
run: git lfs pull
- name: 📦 Install pnpm packages
run: pnpm install
- name: Build Website
run: pnpm build
# with: # with:
# path: . # The root location of your Astro project inside the repository. (optional) # path: . # The root location of your Astro project inside the repository. (optional)
# node-version: 20 # The specific version of Node that should be used to build your site. Defaults to 20. (optional) # node-version: 20 # The specific version of Node that should be used to build your site. Defaults to 20. (optional)
@ -32,7 +60,6 @@ jobs:
needs: build needs: build
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- name: 🚀 Deploy files via SFTP - name: 🚀 Deploy files via SFTP
uses: https://github.com/pressidium/lftp-mirror-action@v1 uses: https://github.com/pressidium/lftp-mirror-action@v1
with: with:
@ -44,5 +71,5 @@ jobs:
parallel: '4' parallel: '4'
settings: 'sftp:auto-confirm=yes' settings: 'sftp:auto-confirm=yes'
localDir: 'public' localDir: 'public'
remoteDir: '/share' remoteDir: '/share/new-website'
options: '--verbose' options: '--verbose'