Skip to content

Commit ed3fe8e

Browse files
committed
update deploy w/ yarn workspace
1 parent ace5c2a commit ed3fe8e

File tree

1 file changed

+35
-19
lines changed

1 file changed

+35
-19
lines changed

.github/workflows/deploy-vue.yml

Lines changed: 35 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -10,33 +10,49 @@ jobs:
1010
deploy-vue:
1111
runs-on: ubuntu-latest
1212
steps:
13-
- run: echo "🎉 The job was triggered by a ${{ github.event_name }} on commit ${{ github.SHA }}"
1413
- name: Check out repository code
15-
uses: actions/checkout@v2
16-
- uses: actions/setup-node@v3
14+
uses: actions/checkout@v4
15+
16+
- name: Setup Node.js
17+
uses: actions/setup-node@v4
1718
with:
1819
node-version: 18
19-
- name: Upload to DO
20+
cache: 'yarn'
21+
22+
- name: Enable Corepack
23+
run: corepack enable
24+
25+
- name: Configure SSH key
2026
uses: shimataro/ssh-key-action@v2
2127
with:
2228
key: ${{ secrets.DO_SSH_KEY }}
2329
name: id_rsa
2430
known_hosts: ${{ secrets.KNOWN_HOSTS }}
25-
- run: npm install -g yarn@1.22.17 # version? 1.22.17 -> 1.22.19 current
26-
- run: npm install -g lerna@3.22.1 # version? 3.22.1 -> 6.6.2 current
27-
- run: npm install -g typescript@4.5.5 # version? 4.5.5 -> 5.1.3 current
31+
32+
- name: Install dependencies
33+
run: yarn install
34+
35+
- name: Set production environment
36+
run: printf "${{ secrets.VITE_ENV }}" > ./packages/vue/.env.production
37+
2838
- name: Build
39+
run: yarn build
40+
41+
- name: Create build info
2942
run: |
30-
lerna bootstrap
31-
printf "${{ secrets.VITE_ENV }}" > ./packages/vue/.env.production
32-
cd ./packages/express
33-
yarn remove @types/jest
34-
cd ../vue
35-
yarn build
36-
- name: Deploy /vue
43+
BUILD_INFO="Build created on $(date) from commit ${{ github.sha }}\n"
44+
BUILD_INFO+="Triggered by ${{ github.actor }} via ${{ github.event_name }}\n"
45+
BUILD_INFO+="Reason: ${{ github.event.inputs.reason }}\n"
46+
echo -e "$BUILD_INFO" > ./packages/vue/dist/buildinfo.md
47+
48+
- name: Deploy to server
3749
run: |
38-
vcount=$(ssh ${{ secrets.DO_USERNAME }}@eduquilt.com ls -1v /home/skuilder/dist/vue/ | tail -n1)
39-
ssh ${{ secrets.DO_USERNAME }}@eduquilt.com mkdir /home/skuilder/dist/vue/$(($vcount+1))
40-
rsync -rl ./packages/vue/dist/ ${{ secrets.DO_USERNAME }}@eduquilt.com:/home/skuilder/dist/vue/$(($vcount+1))
41-
ssh ${{ secrets.DO_USERNAME }}@eduquilt.com ln -sfn /home/skuilder/dist/vue/$(($vcount+1)) /home/skuilder/www
42-
# todo: toss a buildinfo.md file into the (vcount+1) folder, linking PR, listing time, logging build errors, etc
50+
vcount=$(ssh ${{ secrets.DO_USERNAME }}@eduquilt.com ls -1v /home/skuilder/dist/vue/ | grep -E '^[0-9]+$' | tail -n1 || echo 0)
51+
newversion=$(($vcount+1))
52+
echo "Creating directory version $newversion..."
53+
ssh ${{ secrets.DO_USERNAME }}@eduquilt.com mkdir -p /home/skuilder/dist/vue/$newversion
54+
echo "Syncing files to server..."
55+
rsync -rl --delete ./packages/vue/dist/ ${{ secrets.DO_USERNAME }}@eduquilt.com:/home/skuilder/dist/vue/$newversion
56+
echo "Setting symlink to new version..."
57+
ssh ${{ secrets.DO_USERNAME }}@eduquilt.com ln -sfn /home/skuilder/dist/vue/$newversion /home/skuilder/www
58+
echo "Deployment complete to version $newversion"

0 commit comments

Comments
 (0)