Skip to content

Commit

Permalink
refine: new deployment routines
Browse files Browse the repository at this point in the history
  • Loading branch information
chase-moskal committed Sep 15, 2024
1 parent 23b6ee5 commit 68d4796
Show file tree
Hide file tree
Showing 6 changed files with 86 additions and 113 deletions.
20 changes: 6 additions & 14 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,21 +10,13 @@ jobs:
build:
runs-on: ubuntu-latest
steps:

- name: 🔔 checkout
uses: actions/checkout@v4

- name: 🔧 setup node
uses: actions/setup-node@v3
- uses: actions/checkout@v4
- uses: actions/setup-node@v3
with:
node-version: '22'

- name: 📦 install dependencies
run: npm ci

- name: 🔨 build
run: npm run build -s

- name: 🧪 test
run: npm test
- run: |
npm ci
npm run build
npm test
58 changes: 27 additions & 31 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -24,55 +24,51 @@ jobs:
- uses: actions/setup-node@v3
with:
node-version: '22'

- name: set-up s5cmd
- uses: actions/configure-pages@v3
- name: set-up s5cmd, for downloading assets
uses: peak/action-setup-s5cmd@main
with:
version: v2.2.2

- run: npm ci
- run: npm run build
- run: npm test

- name: 🗑️ delete temp assets symlink
run: |
rm -rf x/assets
- uses: webfactory/[email protected]
with:
ssh-private-key: ${{ secrets.REGIS_DIRECTOR_DEPLOYER_SSH_PRIVATE_KEY }}
- run: |
npm ci
npm run build
npm test
- name: deploy the director
- name: 🗑️ delete dev symlinks
run: |
rsync -vhamz --delete --exclude ".git" --exclude "node_modules" -e "ssh -o StrictHostKeyChecking=no" ./ [email protected]:/home/deployer/app/
ssh -o StrictHostKeyChecking=no [email protected] "cd /home/deployer/app && bin/serverside/redeploy"
rm x/assets
rm x/node_modules
rm x/s
- name: 🌎 download assets
- name: 🌎 download assets sources
env:
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
S3_ENDPOINT_URL: "https://sfo2.digitaloceanspaces.com"
run: |
s5cmd cp "s3://benev-storage/regis/x/*" x/assets/
s5cmd cp "s3://benev-storage/regis/s/*" assets/s/
- name: 🚚 tracking ignored stuff
- name: 🎠 converting assets
run: bin/assets-convert

- uses: webfactory/[email protected]
with:
ssh-private-key: ${{ secrets.REGIS_DIRECTOR_DEPLOYER_SSH_PRIVATE_KEY }}

- name: 🎬 deploy the director
run: |
sed -i.bak -e '/^\/node_modules$/d' .gitignore
sed -i.bak -e '/^\/x$/d' .gitignore
rsync --delete -vhamz --exclude ".git" --exclude "node_modules" -e "ssh -o StrictHostKeyChecking=no" ./ [email protected]:/home/deployer/app/
ssh -o StrictHostKeyChecking=no [email protected] "cd /home/deployer/app && bin/serverside/redeploy"
- name: 🗃️ reconstitute node_modules for production
run: |
rm -rf node_modules
npm ci --omit=dev
run: npm ci --omit=dev

- name: 🗃️ copy files
- name: 🍞 moving files into x
run: |
rm -rf x/node_modules x/s
cp -r node_modules/ x/
cp -r s/ x/
- name: 📝 configure pages
uses: actions/configure-pages@v3
mv node_modules x/node_modules
mv s x/s
mv assets/x x/assets
- name: 📤 upload pages artifact
uses: actions/upload-pages-artifact@v2
Expand Down
51 changes: 51 additions & 0 deletions bin/assets-convert
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
#!/bin/bash

banner() {
echo "";
echo "### $1";
}

banner "initialize the assets area";
mkdir -p assets/s;
rm -rf assets/x;
mkdir assets/x;

banner "glbs";
npx @benev/batch 3d glb \
--verbose \
--tier "mid" \
--ignores="**/_*/**" \
--in "assets/s" \
--out "assets/x";

banner "audio";
npx @benev/batch audio m4a \
--verbose \
--kbps "64" \
--in "assets/s" \
--out "assets/x";

banner "images";
npx @benev/batch images webp \
--verbose \
--quality "90" \
--ignores "graphics/**" \
--size "1024" \
--in "assets/s" \
--out "assets/x";

banner "graphics";
npx @benev/batch copy \
--verbose \
--find "*" \
--in "assets/s/graphics" \
--out "assets/x/graphics";

banner "copy: other files";
npx @benev/batch copy \
--verbose \
--find "svg,json,env" \
--ignores "graphics/**" \
--in "assets/s" \
--out "assets/x";

61 changes: 2 additions & 59 deletions bin/assets-down
Original file line number Diff line number Diff line change
Expand Up @@ -6,67 +6,10 @@ banner() {
}

banner "initialize the assets area";
mkdir -p assets/s && \
rm -rf assets/x && \
mkdir assets/x;
mkdir -p assets/s;

banner "download all asset sources";
rsync -vham --delete --progress \
rsync --delete -vham --progress \
mount/benev-storage/regis/s/ \
assets/s;

###
### glbs
###

banner "glbs";
npx @benev/batch 3d glb \
--verbose \
--tier "mid" \
--ignores="**/_*/**" \
--in "assets/s" \
--out "assets/x";

###
### audio effects
###

banner "audio";
npx @benev/batch audio m4a \
--verbose \
--kbps "64" \
--in "assets/s" \
--out "assets/x";

###
### images
###

banner "images";
npx @benev/batch images webp \
--verbose \
--quality "90" \
--ignores "graphics/**" \
--size "1024" \
--in "assets/s" \
--out "assets/x";

banner "graphics";
npx @benev/batch copy \
--verbose \
--find "*" \
--in "assets/s/graphics" \
--out "assets/x/graphics";

###
### copy other files
###

banner "copy: other files";
npx @benev/batch copy \
--verbose \
--find "svg,json,env" \
--ignores "graphics/**" \
--in "assets/s" \
--out "assets/x";

5 changes: 0 additions & 5 deletions bin/assets-up

This file was deleted.

4 changes: 0 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,6 @@
"s"
],
"scripts": {
"mount": "bin/mount",
"unmount": "bin/unmount",
"assets-down": "bin/assets-down",
"assets-up": "bin/assets-up",
"build": "rm -rf x && turtle build --out=x -v && turtle ssg --in=s,x --out=x --exclude=bin -v && run-s links",
"links": "mkdir -p assets/x && ln -s \"$(realpath assets/x)\" x/assets && ln -s \"$(realpath s)\" x/s",
"http": "http-server x",
Expand Down

0 comments on commit 68d4796

Please sign in to comment.